Limit results in jQuery UI Autocomplete
autocomplete, jquery-ui, jquery-ui-autocomplete
Solution
Here is the proper documentation for the jQueryUI widget. There isn't a built-in parameter for limiting max results, but you can accomplish it easily:
$("#auto").autocomplete({
source: function(request, response) {
var results = $.ui.autocomplete.filter(myarray, request.term);
response(results.slice(0, 10));
}
});
You can supply a function to the `source` parameter and then call `slice` on the filtered array.
Here's a working example: http://jsfiddle.net/andrewwhitaker/vqwBP/
Problem
I am using jQuery UI Autocomplete. ``` $("#task").autocomplete({ max:10, minLength:3, source: myarray }); ``` The max parameter doesn't work and I still get more than 10 results. Am I missing something?