扩展jQuery对象本身
jQuery.extend(object)
jQuery.extend({
min:function(a,b){return a<b?a:b;},
max:function(a,b){return a>b?a:b;}
});
jQuery.min(2,3);
jQuery.max(4,5);
扩展对象函数
jQuery.fn.extend(object)
jQuery.fn.extend({
check: function(){
return this.each(function(){this.checked=true;});
},
uncheck:function(){
return this.each(function(){this.checked=false;});
}
});
$("input[type=checkbox]").check();
$("input[type=radio]").uncheck();
jQuery.extend(object)
jQuery.extend({
min:function(a,b){return a<b?a:b;},
max:function(a,b){return a>b?a:b;}
});
jQuery.min(2,3);
jQuery.max(4,5);
扩展对象函数
jQuery.fn.extend(object)
jQuery.fn.extend({
check: function(){
return this.each(function(){this.checked=true;});
},
uncheck:function(){
return this.each(function(){this.checked=false;});
}
});
$("input[type=checkbox]").check();
$("input[type=radio]").uncheck();