jQuery Uncaught TypeError:$(...)。autocomplete不是一个函数 [英] jQuery Uncaught TypeError: $(...).autocomplete is not a function

查看:109
本文介绍了jQuery Uncaught TypeError:$(...)。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>
<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时,我的自动完成功能停止工作。

That was working fine but when I added other JS files like DateTimepicker then my autocomplete function stops working.

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

错误:


未捕获TypeError:$(...)。autocomplete不是函数

Uncaught TypeError: $(...).autocomplete is not a function


推荐答案

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

The issue is because you're including two versions of jQuery. The first one has jQueryUI methods added to it. The second one then overwrites the first. Remove the last jQuery script 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 Uncaught TypeError:$(...)。autocomplete不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆