Programmatically triggering typeahead.js result display

后端 未结 17 1839
余生分开走
余生分开走 2020-11-30 05:01

I am using Twitter\'s typeahead.js (https://github.com/twitter/typeahead.js/) on an input field which is pre filled from a query string. After loading the page, i\'d like to

17条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 05:11

    As of Typeahead v0.10.1, changing the value of the typeahead will trigger another query and open the dropdown:

    var val = $(".typeahead").typeahead('val');
    $(".typeahead").typeahead('val', '');
    $(".typeahead").typeahead('val', val);
    

提交回复
热议问题