Skip to content Skip to sidebar Skip to footer

AddClass Causing Undefined Is Not A Function

I have: mouseOver: function () { var catId = this.category_id; $('#expenditureSummaryGrid .k-grid-content tr').each(function() { if($('td span', this).data('id') == ca

Solution 1:

Since .addClass() is a jQuery function, you likely need to change

this.addClass('grid-hover');

to

$(this).addClass('grid-hover');

Solution 2:

The error of "this" is with the condition inside the for each loop. Can u try

        mouseOver: function () {
                            var catId = this.category_id;
                            $('#expenditureSummaryGrid .k-grid-content tr').each(function(){
                                if(this.find('td span').data('id') == catId) {
                                    this.addClass('grid-hover');
                                }
                            })
                        },

Post a Comment for "AddClass Causing Undefined Is Not A Function"