添加 jQuery UI.js 时自动完成中断
我有一个带有使用 jquery 自动完成的表单的网站。它工作正常,但是当我将 jQuery UI 添加到我的页面时,它停止工作。有谁知道为什么或如何解决它,我似乎找不到原因。
自动完成的代码如下:
head:
<script type="text/javascript" src="js/jquery-1.5.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<script type="text/javascript">
$().ready(function() {
$("#food").autocomplete("search.php", {
width: 260,
cacheLength: 10,
matchContains: false,
//mustMatch: true,
//minChars: 0,
//multiple: true,
//highlight: false,
//multipleSeparator: ",",
selectFirst: true
});
});
</script>
body:
<input type="text" name="food" id="food" / >
因此,当我在代码中将以下行添加到我的 head 时,它会停止工作:
<script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script>
jqQuery 和 jQueryUI 库之间的功能重叠是否会破坏它?关于如何解决这个问题有什么想法吗?
I have a site with a form with autocomplete using jquery. It works fine, however when i add the jQuery UI to my page, it stops working. Does anybody have an idea why or how to fix it, I can't seem to find why.
the code for the autocomplete is as follows:
head:
<script type="text/javascript" src="js/jquery-1.5.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<script type="text/javascript">
$().ready(function() {
$("#food").autocomplete("search.php", {
width: 260,
cacheLength: 10,
matchContains: false,
//mustMatch: true,
//minChars: 0,
//multiple: true,
//highlight: false,
//multipleSeparator: ",",
selectFirst: true
});
});
</script>
body:
<input type="text" name="food" id="food" / >
So when I add the following line to my head in the code it stops working:
<script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script>
Is there overlap in functions between the jqQuery and jQueryUI library that breaks it? Any ideas on how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,自动完成功能在这里重叠。 http://jqueryui.com/demos/autocomplete/
如果你真的不想使用 jQuery UI AutoComplete 那么在 jquery ui 脚本之后调用您的自定义脚本。
Yes the autocomplete function is overlapping here. http://jqueryui.com/demos/autocomplete/
If you really dont wanna use jQuery UI AutoComplete then call your custom script after jquery ui script.