[ACCEPTED]-Autocomplete to show all options on focus. How?-jquery-plugins

Accepted answer
Score: 15

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? :)

Score: 10

This is the correct answer:

    $('.autocompleteTime').autocomplete($sessionTimes, {minChars: 0})
    .focus(function () {
        $(this).autocomplete('search', $(this).val())
    });

0

Score: 6

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

Score: 2

Check out jQuery Ui's Autocomplete combobox 1 example:

http://jqueryui.com/demos/autocomplete/#combobox

Score: 0

That module has now been incorporated into 2 the jQuery UI. This post covers how to 1 deal with this problem now:

Jquery UI autocomplete; minLength:0 issue

More Related questions