JSFiddle - React, Tailwind, and code Playground
by Kishore Polsani
HTML
<link rel="stylesheet" href="http://jquery-ui.googlecode.com/svn/tags/1.8.16/themes/smoothness/jquery.ui.all.css">
<input type="text" id="list" />
CSS
input {
margin: 10px;
}
JavaScript
(function() {
var manufacturers = ['Volkswagen', 'Audi', 'Mercedes', 'Skoda', 'Toyota', 'Renault', 'Volvo', 'Mazda'];
var res;
$.ajax({
url: "https://content.atomz.com/autocomplete/sp10/04/fa/17",
success: function(result) {
console.log('before ' + result);
result = result.replace('( ', '');
res = result.replace(' )', '');
$("#list").autocomplete({
source: res
});
}
});
// Overrides the default autocomplete filter function to search only from the beginning of the string
$.ui.autocomplete.filter = function(array, term) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(term), "i");
return $.grep(array, function(value) {
return matcher.test(value.label || value.value || value);
});
};
})();