未捕获类型错误:$(...)自动完成不是一个函数 [英] Uncaught TypeError: $(...).autocomplete is not a function
问题描述
我想实现一个jQuery自动完成文本框。我不能让我的自定义的工作,所以我想实现股票文本框,而不是开始与这样我就可以解决这个错误。我不知道在哪里这是从考虑到我已经包括所有的文件来该页面(的https:/ /jqueryui.com/autocomplete/#default )曾建议。除演示css文件,但是这并不重要因为CSS不应与文本框的功能intefere。
下面是code:
< HEAD>
<标题>< /标题>
<链接HREF =〜/内容/ ClientDash.css的rel =stylesheet属性/>
<链接rel =stylesheet属性HREF =// code.jquery.com / UI / 1.11.4 /主题/平滑度/ jQuery的-ui.css>
<脚本>
$(函数(){
VAR availableTags = [
动作,
AppleScript的
ASP
BASIC,
C,
C ++,
Clojure的
COBOL
ColdFusion的
二郎
FORTRAN,
常规
哈斯克尔
Java的,
JavaScript的
Lisp的,
Perl的
PHP
蟒蛇,
红宝石,
斯卡拉
方案
];
$(#标签)。自动完成({
来源:availableTags
});
});
< / SCRIPT>
< /头>< DIV CLASS =UI窗口小部件>
<标签=标签>标签:LT; /标签>
<输入ID =标签>
< / DIV>
布局:
< HEAD>
<脚本SRC =〜/脚本/ jQuery的-2.1.4.min.js>< / SCRIPT>
<脚本SRC =〜/脚本/ jQuery的-UI-1.11.4.min.js>< / SCRIPT>
< /头>
您需要包括 jQuery库
在 jQuery UI的
检查此小提琴
I'm trying to implement a JQuery autocomplete text box. I couldn't get my custom one to work, so I'm trying to implement the stock text box instead to begin with so I can fix this error. I'm not sure where this is coming from considering that I have included all of the files which the page(https://jqueryui.com/autocomplete/#default) has suggested. Except the demo css file, but this doesn't matter as the css shouldn't intefere with the functionality of the text box.
Here is the code:
<head>
<title></title>
<link href="~/Content/ClientDash.css" rel="stylesheet" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script>
$(function () {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: availableTags
});
});
</script>
</head>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
Layout:
<head>
<script src="~/Scripts/jquery-2.1.4.min.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.min.js"></script>
</head>
You need to include jquery library
before jquery ui
check this fiddle
这篇关于未捕获类型错误:$(...)自动完成不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!