Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.autocomplete is not a function Error

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

like image 688
user2454340 Avatar asked Oct 25 '13 13:10

user2454340


People also ask

How do I fix autocomplete is not a function?

To solve the "$(...). autocomplete is not a function" jQuery error, make sure to load the jQuery library before loading the jQuery UI library. The libraries have to be loaded only once on the page, otherwise the error is thrown.

Is not a function error in jQuery?

on if not a function" jQuery error occurs for 2 main reasons: Loading an old version of the jQuery library that doesn't support the on function. Loading a library that overrides the value of the dollar sign $ variable.

Is not a function Typeerror is not a function?

This is a standard JavaScript error when trying to call a function before it is defined. This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the expression did not return a function object.

Is not defined in jQuery?

You may experience the “jQuery is not defined error” when jQuery is included but not loaded. Make sure that it's loaded by finding the script source and pasting the URL in a new browser or tab. The snippet of text you should look for to find the URL to test.


Video Answer


1 Answers

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.

like image 168
user2454340 Avatar answered Oct 15 '22 02:10

user2454340