javascript - Difference in referring this variable in jquery -
i confused between variable in below code.
jquery.fn.extend({ check: function() { return this.each(function() { this.checked = true; }); }, uncheck: function() { return this.each(function() { this.checked = false; }); } }); // use newly created .check() method $( "input[type='checkbox']" ).check();
please tell me this refers object.
in this.each
, this
refers collection of elements in provided jquery object. in example, all of input[type="checkbox"]
elements.
in this.checked
, this
single domelement within iteration of each
loop.
Comments
Post a Comment