For the above example, we can call the jquery.fn.extend() method to create a jquery object method. The specific code is as follows》
jQuery.fn.extend({
test : function(){
return this.each(function(){
alert(this.nodeName);
})
}
});
The call is the same as above
$(' body *').click(function(){
$(this).test().html(this.nodeName).hide(1000);
});
So far, we have introduced two methods of writing jquery plug-ins, jquery.extend() and jquery.fn.extend(). Have you learned it?