jQuery插件开发分为两种:1 类级别、2 对象级别
1、类级别
$.extend({
add:function(a,b){return a+b;} ,
minus:function(a,b){return a-b;}
});
调用方式
var i = $.add(3,2);
var j = $.minus(3,2);
2、对象级别
$.fn.extend({
check:function(){
return this.each({
this.checked=true;
});
},
uncheck:function(){
return this.each({
this.checked=false;
});
}
});
调用方式
$('input[type=checkbox]').check();
$('input[type=checkbox]').uncheck();

posted on
浙公网安备 33010602011771号