contactmatt
contactmatt

Reputation: 18600

jQuery Autocomplete - Display list of values on focus

I'm using Autocomplete for a small set of values. I would like the "Autocomplete" source values to immediately display when the user focuses on a the input box (either using the keyboard or mouse), rather than waiting for them to type.

How can I get the source values to immediately display upon focus?

Thank You,

        $("#cityInput").autocomplete({
            minLength: 0, // With not that many cities, require at no characters before showing autocomplete
            source: getJson(),
            // plug-in to the select event in order to keep KnockOut informed about the 
        });

Upvotes: 2

Views: 754

Answers (1)

Amar
Amar

Reputation: 1936

You can do this by calling "search" method of autocomplete on its "focus" event, check this JQFAQ.com topic which says how to do this. There are few other interesting FAQ related to autocomplecte, that may be helpful to you.

Upvotes: 5

Related Questions