一 、html文件
jQuery 插件事例
二、js文件
;(function($){ $.fn.extend({ appendmine : function(){ var html = "这是通过插件来的
"; return this.each(function(){ $(this).append(html); }); }, removemine : function(){ return this.each(function(){ $(this).html(""); }); } });})(jQuery);;(function($){ $.extend({ openDiv : function(param){ var options = $.extend({ msg : "请稍等……" }, param); var $openDiv = $("" + options.msg + ""); $openDiv.css({textAlign: "center", backgroundColor: "rgb(209, 194, 194)", height: "200px", width: "800px", opacity: "0.5"}); $openDiv.appendTo($(document.body)); $._data(document, "$openDiv", $openDiv); }, closeDiv : function(){ var $openDiv = $._data(document, "$openDiv"); if ($openDiv) { $openDiv.remove(); } $(".abc").remove(); } });})(jQuery);