开发者

How to trigger autocomplete search event

开发者 https://www.devze.com 2023-01-30 16:05 出处:网络
I have jQuery autocomplete setup on an input box. It is working fine. However, I want to have a button that when clicked will trigger autocomplete as though the user type some text in the input.I wo

I have jQuery autocomplete setup on an input box.

It is working fine.

However, I want to have a button that when clicked will trigger autocomplete as though the user type some text in the input. I would pass a specific string.

开发者_Python百科

Any ideas on how I can do this?


JQuery UI's autocomplete has a search method:

myAutocomplete.autocomplete('search', 'sometext');


This worked for where #inputID is a text input on which the autocomplete is attached.

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

Tested in FireFox and Chrome (Ubuntu 12.04 LTS)

0

精彩评论

暂无评论...
验证码 换一张
取 消