Youss
Youss

Reputation: 4212

Open autocomplete on click

I'm using the Jquery autocomplete: Autocomplete

I would like to open the autocomplete with event click:

$(div).live('click', function(e){

...?????....

});

What can I do to open it?

Upvotes: 2

Views: 2076

Answers (1)

Pavel Strakhov
Pavel Strakhov

Reputation: 40502

From documentation of search method:

Can be called with an empty string and minLength: 0 to display all items.

So, your code should be:

$(div).live('click', function(e) {
  $(div).autocomplete("option", "minLength", 0).autocomplete("search", "");
});

Upvotes: 4

Related Questions