jquery - .change() on an attribute value? -


this question has answer here:

is there trigger within jquery detect changes in attributes' values?

as example:

<div id="thisfield" value-grabbed='1'></div>

to

<div id="thisfield" value-grabbed='2'></div>

and jquery gives me alert after change saying "done."

edit----

i'll more going change attributes' value using .attr() code.

yes, have create said trigger yourself.

$(element).attr("value-grabbed","2").trigger("attrchange"); 

you can automate overriding attribute method:

(function($){ // avoid global conflicts     var oldfn = $.fn.attr;      $.fn.attr = function(){             var ret = oldfn.apply(this,arguments);         if (arguments.length === 2 || typeof arguments[0] === "object") {             this.trigger("attrchange");         }                     return ret;     } })(jquery); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -