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
Post a Comment