I have a jQuery ComboBox input that when focused I want to automatically open up the autocomplete menu.
However, simply clearing the input and focusing it like this:
$('#select-id').val('').focus();
...doesn't work. If you manually focus an autocompleter input and then clear it, it does display the autocomplete menu.
Is there a way I can trigger the auto complete menu to open on focus? I also would want it to show the complete menu, so I'd want to clear the input text as well.
Assuming you're using the combobox that's an extension of the autocomplete widget:
$("your_selector").bind("focus", function () {
this.value = '';
$(this).autocomplete("search", '');
});
Should work fine.
Working example (normal autocomplete widget): http://jsfiddle.net/gEuTV/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With