下面是沒有運行,我不斷得到Uncaught TypeError: $(...) is not a function(anonymous function) @ global.js:80j @ jquery.min.js:2k @ jquery.min.js:2
'這是'})(jQuery);
被呼叫的目標線'。我已經嘗試在文檔的<head>
中重新組織我的外部腳本,並嘗試使用JS lint,唉我繼續得到這個錯誤。連續控制檯錯誤與我的jQuery自動完成功能
$(document).ready(function() {
$(function($, undefined) {
$.widget("app.autocomplete", $.ui.autocomplete, {
_create: function() {
if(this.element.is("select")) {
var self = this;
this.original = this.element.hide();
this.element = $("<input/>").insertAfter(this.original);
this.options.source = function(request, response) {
var filter = $.ui.autocomplete.filter,
$options = self.original.find("option"),
result = $options.map(function() {
return $(this).val();
});
response(filter(result, request.term));
};
}
this._super("_create");
},
_destroy: function() {
this._super("_destroy");
this.element.remove();
this.original.show();
}
});
})(jQuery);
$(function() {
$("#autocomplete").autocomplete();
});
});
爲什麼你將'jQuery'作爲一個參數*傳遞給已經假定存在'$'變量的函數? – nnnnnn