Greg Greg - 1 year ago 55
jQuery Question

JQuery UI Autocomplete - Have the menu open when user clicks in the text box

I'm using this JQuery autocomplete widget.

How can I make it automatically open the menu when the user clicks in the text box? I want the user to see all the options.

Answer Source

You need to trigger the search event manually and set the minLength option on the widget to zero:

    minLength: 0,
    /* other options */
}).on("focus", function () {
    $(this).autocomplete("search", "");

Working example: