I have an array like
["JOAQUIN", "BERNARDINO", "MODOC","ALASKA","MADERA", "ANDERSON"]
jQuery UI Autocomplete
var myarray= ["JOAQUIN", "BERNARDINO", "MODOC","ALASKA","MADERA", "ANDERSON"] myarray.sort();
we are passing two arguments into source one is
request and second is
request is stands for request object we are making, in our case it is
the letter we are typing into textbox.
response is function which
will return us auto complete selection options.
$.map we are checking typed words with array we have named json.
json.toUpperCase().indexOf(request.term.toUpperCase()) this line convert typed word and array to same case and return it.
and matches would be the final result which has list of item that you have asked.
response(matches); will send it to autocomplete.