jQuery autoComplete view all on click?

后端 未结 22 2098
北恋
北恋 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:19

    I have seen all the answers which seem to be complete.

    If you want to get the list when the cursor is in the text field OR when you click on the matching label, here how you can do:

    //YourDataArray = ["foo","bar"];
    $( "#YourID" ).autocomplete({
                source: YourDataArray 
            }).click(function() { $(this).autocomplete("search", " "); });
    

    this works fine in Firefox, IE, Chrome ...

提交回复
热议问题