0
我正在嘗試爲JQuery Mobile創建一個插件。有沒有人有一個模板或例子來幫助?目前,我有以下的myplugin.jsjquery手機插件創建
(function ($) {
$.fn.myPlugin = function (options) {
var defaults = { e: 0 },
settings = $.extend({}, defaults, options);
var h= $.myPlugin.getHtml(options.e);
alert("here 1");
if ((h != null) && (h != undefined) && (h.length > 0)) {
alert("here 2");
this.html(h);
}
};
$.myPlugin = {
getHtml: function (e) {
var s = "";
return s;
}
};
})(jQuery);
我想初始化這個插件的一個實例,像這樣的定義:
$("#pluginInstance", "#myPage").myPlugin({ e: 0 });
奇怪的是,沒有出現警告對話框。控制檯中沒有任何錯誤。我究竟做錯了什麼?