开发者

Need help understanding code

开发者 https://www.devze.com 2023-03-11 12:39 出处:网络
hi all i am new in jquery this code in book jQuery in action page 219 why he use .e开发者_StackOverflow社区nd() method

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消