Search code examples
javascriptjquerytypeaheadtypeahead.js

Is there a way to close the dropdown menu for typeahead.js?


I'm using typeahead.js for a typeahead.

I basically want to do the reverse of this: Programmatically triggering typeahead.js result display

I've tried to do a .trigger('blur'); on the typeahead, but I set the value right before that by doing .typeahead('setQuery', value);. Doing 'setQuery' fires off an ajax request to fetch results with the new query term. So the "blur" takes place, but the box is opened soon thereafter.


Solution

  • Instead of calling setQuery, add another function that doesnt do getSuggestions, and youll have a good time.