I have a huge application, where addClassand removeClass jquery is used in many places. I want to do some work on which element is changed by a class based on which class is added / removed. A longer route would be to add a piece of code to the application after addClassand removeClass, but I was thinking if I could override these jquery functions somehow, then my life would be much easier. I tried the code below.
var oAddClass = jQuery.fn.addClass;
jQuery.fn.addClass = function (arg) {
alert(this);
alert(arg);
return oAddClass.apply(this, arg);
};
But getting the error “ Function .prototype.apply: argument is not an object ” inreturn oAddClass.apply(this, arg);
Can someone help me?
source
share