php - Javascript: Uncaught Type error Autocomplete is not a function -


i'm aware question has been posted lot have been going through every answer trying find solution has not worked code.

i'm trying call autocomplete function using jquery-ui on search bar, every time load page type error saying autocomplete not function.

i've removed every instance of loading javascript ui , placed in seperate file in javascript folder called "jquery-ui-src.php", looks this

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

which called in files need use jquery-ui. file error being caught think in "header.php" file acts header whole site

<?php     session_start();     include("assets/js/jquery-ui-src.php");  ?>  <header id="header" class="website-header">  //other code included here  //code search bar  <form role="search" action="<?php echo site_url; ?>search" method="get" style="width: 12em; margin: 0.1em 2em;margin-left:7em">     <div class="input-group">         <input type="text" id="tags" class="search-field form-control">         <div class="input-group-btn">             <button type="submit" class="btn btn-default">search</button>         </div>     </div> </form> </div>  //other code included here     <script> $(document).ready(function(){     $("#account-dropdown").click(function(){         $("#account-box").slidetoggle(400);         $(this).css("color", "white");         return false;     });                              var availabletags = [         "actionscript",         "applescript",         "asp",         "basic",         "c",         "c++",         "clojure",         "cobol",         "coldfusion",         "erlang",         "fortran",         "groovy",         "haskell",         "java",         "javascript",         "lisp",         "perl",         "php",         "python",         "ruby",         "scala",         "scheme"     ];      $("#tags").autocomplete({         source: availabletags     });  }); </script> </header> 

whenever page loads error saying autocomplete not function , can't figure out why it's doing this.

any appreciated, thanks.

edit

i've removed second instance in header file jquery script called , i'm still getting error.

additional information may of use here, wasn't 1 made initial files , i've been given few tasks improve it, 1 being getting search bar use may useful know there multiple (quite lot in fact) files in project. lot of these call different scripts well, should move these scripts "jquery-ui-src.php" file? possible fix error?

because importing jquery in middle, hence imported jquery-ui-src.php has been reset.

please try removing line:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

there invalid ending tag: </div>//other code included here. remove it.

below working code. here fiddle .

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>  <header id="header" class="website-header">     <form role="search" action="" method="get" style="width: 12em; margin: 0.1em 2em;margin-left:7em">         <div class="input-group">             <input type="text" id="tags" class="search-field form-control" />             <div class="input-group-btn">                 <button type="submit" class="btn btn-default">search</button>             </div>         </div>     </form>     <script>         $(document).ready(function() {             $("#account-dropdown").click(function() {                 $("#account-box").slidetoggle(400);                 $(this).css("color", "white");                 return false;             });             var availabletags = [                 "actionscript",                 "applescript",                 "asp",                 "basic",                 "c",                 "c++",                 "clojure",                 "cobol",                 "coldfusion",                 "erlang",                 "fortran",                 "groovy",                 "haskell",                 "java",                 "javascript",                 "lisp",                 "perl",                 "php",                 "python",                 "ruby",                 "scala",                 "scheme"];              $("#tags").autocomplete({                 source: availabletags             });          });     </script> </header> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -