[ACCEPTED]-Autocomplete to show all options on focus. How?-jquery-plugins
You have to set minChars to be 0, like this:
$('.autocompleteTime').autocomplete($sessionTimes, {minChars: 0});
Also 4 note that you don't have to start variable 3 name with a $, you could just write sessionTimes 2 everywhere you use it and it would be okay. Probably 1 coming from a PHP background? :)
This is the correct answer:
$('.autocompleteTime').autocomplete($sessionTimes, {minChars: 0})
.focus(function () {
$(this).autocomplete('search', $(this).val())
});
0
The selected answer is a bit old and didn't 3 really work for me, so what worked for me 2 was this:
$('#selector')
//use minLength when initializing so that empty searches work
.autocomplete({..., minLength: 0})
//trigger the search on focus
.focus(function(){
$(this).autocomplete('search', $(this).val());
})
Credits to the comment by @notJim 1 above and this question: Display jquery ui auto-complete list on focus event, and to me
Check out jQuery Ui's Autocomplete combobox 1 example:
That module has now been incorporated into 2 the jQuery UI. This post covers how to 1 deal with this problem now:
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.