.autocomplete 不是函数错误 [英] .autocomplete is not a function Error

查看:26
本文介绍了.autocomplete 不是函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/><script src="http://code.jquery.com/jquery-1.9.1.js"></script><script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

我的 Html 代码是

<input name="searcharea" class="selectarea" id="searcharea" type="text" value="" placeholder="Area">

而我的功能是

我已将此页面包含到带有我网站搜索代码的单独文件中,并将其嵌入到各个页面中,在我的索引页面上,它建议我从源文件中获取值,但在其他页面上,它给了我打字错误在线

$( "#searcharea" ).autocomplete({

我的网站链接是:http://www.jodhpuryp.in/

这是我的自动建议框的来源http://api.jqueryui.com/autocomplete/

谁能告诉我,为什么我在网站的其他页面上在索引页面上工作时会出现此错误.感谢任何帮助.谢谢

解决方案

发现问题,我为我的 google 翻译器添加了另一个 jquery 文件,它们相互冲突,导致无法加载自动完成功能.

below is my My Code

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

And my Html code is

<div class="ui-widget">
<input name="searcharea" class="selectarea" id="searcharea" type="text" value="" placeholder="Area">
</div>

And my Function is

<script>
$(function(){
    $( "#searcharea" ).autocomplete({
        source: "suggestions.php"
    });
    $( "#searchcat" ).autocomplete({
        source: "suggestions1.php"
    });
});
</script>

I have included this page into a seperate file with search code of my website and I have embeded it on various pages, On my index page, it is suggesting me values from source files, but on other pages it is giving me typerror on line

$( "#searcharea" ).autocomplete({

My website link is: http://www.jodhpuryp.in/

This is source of my autosuggestion box http://api.jqueryui.com/autocomplete/

Can anybody tell me, why I am getting this error on other pages of my website while its working on index page.Any help is appreciated.Thanks

解决方案

Found the problem, I was including another jquery file for my google translator, they were conflicting with each other and resulting in not loading the autocomplete function.

这篇关于.autocomplete 不是函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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