How to display jQuery UI autocomplete list on focus event

At the time of working with jQuery UI autocomplete, sometimes we’re getting a requirement to display list on focus. Means the autocomplete list would be shown on focusing the input box. Once start entering in the input field, autocomplete list would be filtered as per the entered character.

focus() event of jQuery UI autocomplete lets you to show all options before start entering. You need to add the .focus(function(){}) with your existing jQuery UI autocomplete code.

$(function() {
    $( "#searchInput" ).autocomplete({
        source: "searchList.php",
        minLength: 0
        if (this.value == ""){

Leave a reply

CodexWorld Newsletter

Subscribe CodexWorld updates via email and get every new post delivered to your inbox.