keep ui autocomplete open at all times

前端 未结 4 1209
渐次进展
渐次进展 2020-12-06 05:51

I\'m using the ui autocomplete: over here

I need the autocomplete to be open at all times, so it shouldn\'t close when somewhere in the body is clicked. I have googl

4条回答
  •  我在风中等你
    2020-12-06 06:14

    here's a working example of how to do it : http://jsfiddle.net/4pk3V/

    keep your autocomplete box open by searching the same input again whenever close event is triggered:

    $( "#input" ).autocomplete({
        source: availableTags,
    
        close : function (event, ui) {
             val = $("#comment").val();
             $("#input").autocomplete( "search", val ); //keep autocomplete open by 
             //searching the same input again
             $("#input").focus();
            return false;  
        }
    });
    

提交回复
热议问题