JQuery AutoComplete: Overriding Default Behavior

I want to have some kind of custom autocomplete, and I thought it made sense to configure jQuery autocomplete. Therefore, I would like to know:

  • How to force open autocomplete list? $("#autocomplete").trigger('autocompleteopen'); does not work.

  • How to put your own data in a list? Obviously, not through the source parameter, but from the outside.

In other terms, starting from 1 and 2, I want to have a list of all (unlimited limit ), and I want it to open and show all the parameters before running the user for input and no matter what the user types.

Any help would be appreciated.

Greetings
Pars

+7
jquery autocomplete jquery-autocomplete
source share
1 answer

Another answer didn’t help me much (regarding your question 1), however after a short search I found the easiest way to get the autocomplete list to open. All you have to do is just call the search method.

The first thing you need to do is initialize your autocomplete with a minimum length of 0, for example:

 $('#autocomplete').autocomplete({ minLength: 0, ... }); 

Then you can call the search method to open the list:

 $('#autocomplete').autocomplete('search'); 

Hope this helps other people find the answer to this problem.

+10
source share

All Articles