0
votes

I want to use the autocomplete function of jquery ui but I have a problem.

I use the external library of google:

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

< script type = "text/javascript"
src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" > < /script>

My autocomplete script

$("#search").autocomplete({
  source: 'autocomplete-search.php',
});

I have this error:

jQuery.Deferred exception: $(...).autocomplete is not a function TypeError: $(...).autocomplete is not a function

at HTMLDocument. (http://localhost/sitename/script.js:382:16) at j (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:29948) at k (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:30262) >undefined

1

1 Answers

1
votes

you also need to include JQuery itself into your project, before the jquery-ui include. To be able to parse this,

$("#search")

, JQuery itself is required. Try including this from google, before your other script.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>