hi all i am new in jquery
this code in book jQuery in action page 219
why he use .e开发者_StackOverflow社区nd()
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 this
to allow chaining.
Using .end()
he undoes .filter('input:text')
so finally he's returning the this
jQuery object.
精彩评论