$.extend(prop) 扩展jQuery对象。可以用于把函数添加到jQuery名称空间中,以及添加插件方法(插件)。 返回值:Object参数:prop (Object): 要合并到jQuery对象中的对象 

1, 添加方法,如同$("button").click()方法一样使用:

jQuery.fn.extend({ 
  check: function() { 
    return   this.each(function() { this.checked = true; }); 
  },  
  uncheck: function() { 
    return   this.each(function() { this.checked = false; }); 
  } 
});
 

然后直接调用方法

选中所有checkbox;$(":checkbox").check();

取消选中radio:$(":radio").uncheck();

2, 为jQuery对象添加函数 如同$.trim()一样使用:

jQuery.extend({ 
     min: function(a, b) { return a < b?? a?: b; }, 
     max: function(a, b) { return a > b?? a?: b; }  
  });
 

可以直接调用函数如: $.min(5,4).