针对上面的示例,我们可以调用jquery.fn.extend()方法来创建jquery对象方法。具体代码如下:  
复制代码 代码如下:
jQuery.fn.extend({ 
test : function(){ 
return this.each(function(){ 
alert(this.nodeName); 
}) 
} 
});  
调用跟上面一样。  
复制代码 代码如下:
$('body *').click(function(){ 
$(this).test().html(this.nodeName).hide(1000); 
}); 
 
目前,我们已经介绍了写jquery插件的两种方法,jquery.extend() 和jquery.fn.extend(),您都掌握了吗?