hi all i am new in jquery
this code in book jQuery in action page 219
why he use .end() method
and thanks 🙂
(function($){
$.fn.setReadOnly = function(readonly) {
return this.filter('input:text')
.attr('readOnly',readonly)
.css('opacity', readonly ? 0.5 : 1.0)
.end();
};
})(jQuery);
A jQuery function should return
thisto allow chaining.Using
.end()he undoes.filter('input:text')so finally he’s returning thethisjQuery object.