复制代码 代码如下:
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(),你学会了吗。
