A Plugin for autocomplete.
Plugin requires you to load jQuery first.
Then load the autocomplete.min.js file
<script type="text/javascript" src="autocomplete.min.js"></script>
You have to call the autocomplete function.
$("#auto").autocomplete({
});
For getting suggestions you have to pass an array for suggestions as parameter to the function.
var params = ['Apple','Orange','Grapes','Banana'];
$("#auto").autocomplete({
array: params
});
You can choose if you want to auto fill the input field. By deafult the param is set to true.
var params = ['Apple','Orange','Grapes','Banana'];
$("#auto").autocomplete({
array: params,
autofill:false
});
If you want to get suggestion from a server. You can provide the url
$("#auto").autocomplete({
autofill:false,
url: "PASTE YOUR URL HERE"
});
If both array and url are passed as parameter then only array will be consider for suggestion. So if you want data from url you have to skip the array parameter.