我正在尝试使用 jQuery UI 自动完成小部件,但在 Google Chrome 中出现以下错误:
Uncaught TypeError: undefined is not a function jquery-ui.min.js:7
e.widget.refresh jquery-ui.min.js:7
(anonymous function) jquery-ui.min.js:6
e.widget._create jquery -ui.min.js:6
(匿名函数) jquery-ui.min.js:6
e.Widget._createWidget jquery-ui.min.js:6
e.(匿名函数).(匿名函数) jquery-ui. min.js:6
(匿名函数) jquery-ui.min.js:6
n.extend.each jquery-2.1.1.min.js:2
n.fn.n.each jquery-2.1.1.min.js :2
e.fn.(匿名函数)jquery-ui.min.js:6
e.widget._create jquery-ui.min.js:7
(匿名函数)jquery-ui.min.js:6
e.Widget。 _createWidget jquery-ui.min.js:6
e.(匿名函数).(匿名函数) jquery-ui.min.js:6
(匿名函数) jquery-ui.min.js:6
n.extend.each jquery-2.1.1.min.js:2
n .fn.n.each jquery-2.1.1.min.js:2
e.fn.(匿名函数) jquery-ui.min.js:6
(匿名函数) create:684
j jquery-2.1.1.min. js:2
k.fireWith jquery-2.1.1.min.js:2
n.extend.ready jquery-2.1.1.min.js:2
I jquery-2.1.1.min.js:2
我在标题中包含 jQuery 和 jQuery UI,如下所示:
<head>
<meta charset="utf-8">
<title>Client DB</title>
<link href="/css/styles.css" rel="stylesheet" />
<link href="/css/selectize.default.css" rel="stylesheet" />
<link href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="/js/jquery-2.1.1.min.js"></script>
<script src="/js/jquery-ui.min.js"></script>
<script src="/js/selectize.min.js"></script>
<script src="/js/autogrow.js"></script>
<script src="/js/jquery.mattni.cloner-0.1.js"></script>
<script src="/js/filter-years.js"></script>
<script src="/js/jquery.filter.js"></script>
</head>
然后我像这样在我的 HTML 末尾调用该函数(我已经替换了一些对客户端敏感的信息):
<script>
$(function(){
console.log("You autocomplete me");
var availableTags = ["Autofill 1","Autofill 2"];
$("#ref").autocomplete({source: availableTags});
$("#basis").autocomplete({source: ["Choice 1", "Choice 2"]});
$("#brand").autocomplete({source: ["Possible option", "Unladen swallow"]});
});
</script>
这曾一度奏效,现在突然就这样了。我在网上搜寻了有同样问题的人。我只能找到人们收到一两个错误的例子,而不是像这样的长列表。如果我在 Google 上链接到 jQuery 和 jQuery UI,我会遇到同样的错误,所以我知道这不是文件的问题。
有没有人以前见过这些错误或知道如何修复它们?