Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery未捕获类型错误:$(…)。自动完成不是函数_Javascript_Jquery_Autocomplete - Fatal编程技术网

Javascript jQuery未捕获类型错误:$(…)。自动完成不是函数

Javascript jQuery未捕获类型错误:$(…)。自动完成不是函数,javascript,jquery,autocomplete,Javascript,Jquery,Autocomplete,我有以下文件 <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script>

我有以下文件

<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<link href="css/style2.css" rel="stylesheet" type="text/css" />
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/index.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>

这很好,但当我添加其他JS文件(如DateTimepicker)时,我的自动完成功能停止工作

<script src="js/jquery.datetimepicker.full.js" type="text/javascript"></script>
<link href="css/jquery.datetimepicker.css" rel="stylesheet" type="text/css" />

错误:

未捕获类型错误:$(…)。自动完成不是函数


问题是因为您包含了两个版本的jQuery。第一个添加了jQueryUI方法。然后,第二个将覆盖第一个。删除最后一个jQuery
脚本
include

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<!-- REMOVE THIS >> <script src="js/jquery.js" type="text/javascript"></script> -->
<script src="js/jquery.datetimepicker.full.js"></script>

<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/resources/demos/style.css">
<link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.css" />
<link rel="stylesheet" type="text/css" href="css/style2.css" />
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/index.css" />

似乎您已经添加了两次
jQuery库

只保留一次


无论是这一个
还是

在出现故障的地方添加jquery代码,我们都可以帮助您。感谢您前来救援。我花了几个小时弄清楚我做错了什么。我在两个地方包括jQuery。在jquery-ui.js之后,我在一个地方删除了一个。感谢您解释错误的原因。