Javascript 需要帮助理解代码吗
大家好,我是jquery的新手 这段代码出现在jQuery手册的第219页 为什么他使用Javascript 需要帮助理解代码吗,javascript,jquery,Javascript,Jquery,大家好,我是jquery的新手 这段代码出现在jQuery手册的第219页 为什么他使用.end()方法 谢谢:) jQuery函数应该返回this以允许链接 使用.end()他撤消了.filter('input:text')所以最后他返回了这个jQuery对象 (function($){ $.fn.setReadOnly = function(readonly) { return this.filter('input:text') .attr('readOnly',readonly) .css
.end()
方法
谢谢:)
jQuery函数应该返回
this
以允许链接
使用.end()
他撤消了.filter('input:text')
所以最后他返回了这个
jQuery对象
(function($){
$.fn.setReadOnly = function(readonly) {
return this.filter('input:text')
.attr('readOnly',readonly)
.css('opacity', readonly ? 0.5 : 1.0)
.end();
};
})(jQuery);