jQuery.fn.extend(object)
查看Plugins/Authoring可以获取更多信息。
jQuery.fn.extend({
isCheck: function() {
return this.each(function() { this.checked == true; });
},
isUncheck: function() {
return this.each(function() { this.checked == false; });
}
});
$("input[type=checkbox]").isCheck();
$("input[type=radio]").isUncheck();//========================================================================================================================
jQuery.extend({
min: function(a, b) { return a < b ? a : b; },
max: function(a, b) { return a > b ? a : b; }
});
jQuery.min(2,3); // => 2
jQuery.max(4,5); // => 5
本文介绍如何使用jQuery扩展自定义方法,包括检查复选框状态和实现简单的数学运算功能。通过jQuery.fn.extend()和jQuery.extend()函数,开发者可以方便地为jQuery增加新的功能。

247

被折叠的 条评论
为什么被折叠?



