jQuery autoComplete view all on click?

后端 未结 22 2079
北恋
北恋 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

    hope this helps someone:

    $('#id')
            .autocomplete({
                source: hints_array,
                minLength: 0, //how many chars to start search for
                position: { my: "left bottom", at: "left top", collision: "flip" } // so that it automatically flips the autocomplete above the input if at the bottom
                })
            .focus(function() {
            $(this).autocomplete('search', $(this).val()) //auto trigger the search with whatever's in the box
            })
    

提交回复
热议问题