How to trigger an autocomplete event

I have jQuery autocomplete setting in input field.

It works great.

However, I want to have a button that, when clicked, causes autocomplete, as if the user was entering text into the input. I would pass a specific string.

Any ideas on how I can do this?

+5
source share
2 answers

JQuery UI autocompletion has a method search:

myAutocomplete.autocomplete('search', 'sometext');
+8
source

This worked when #inputID- text input on which autocomplete is attached.

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

Tested in FireFox and Chrome (Ubuntu 12.04 LTS)

+3
source

All Articles