jQuery autoComplete view all on click?

后端 未结 22 2050
北恋
北恋 2020-12-02 09:52

I\'m using jQuery\'s autocomplete in a relatively simple way:

$(document).ready(function() {
  var data = [ {text: \"Choice 1\"}, 
               {text: \"Ch         


        
22条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 10:07

    You can trigger this event to show all of the options:

    $("#example").autocomplete( "search", "" );
    

    Or see the example in the link below. Looks like exactly what you want to do.

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

    EDIT (from @cnanney)

    Note: You must set minLength: 0 in your autocomplete for an empty search string to return all elements.

提交回复
热议问题