0
我建立jQuery插件:jQuery的這個範圍內插件
(function($){
var methods = {
init : function(options) {
$.fn.queryBuilder = $.extend($.fn.queryBuilder, options);
return this.each(function(){
methods.getValues();
var $this = $(this),
data = $this.data('queryBuilder'),
url = '/'+methods.createURL.call();
if (! data) {
$(this).data('queryBuilder', {
target : $this,
url : url
});
}
});
},
getURL:function(){
alert $(this);
}
}
$.fn.queryBuilder = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.tooltip');
}
};
})
當的GetValues()方法被調用時,警報顯示未定義。如何使用範圍調用getValues到我的插件綁定的對象?