This jQuery autocomplete code show all options, regardless of what is typed in the input field. How are the displayed options limited to items based on what it typed?
jQuery(document).ready(function($) {
$("#inputfield").autocomplete({
minLength: 0,
source: function(request, response) {
var data = $.map(resultUsers, function(value, key) {
return {
label: value.name + " - " + value.city,
value: value.name
}
});
response(data);
}
}).focus(function() {
$(this).autocomplete("search", "");
});
});
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<input id="inputfield">