Typeahead.js at Blur Event

I am using Twitter Typeahead . There is a problem, when I preloaded the data in my text field and in the blur event, the text field is cleared. This is a known issue within the type ahead, and it says that it has been fixed. But I canโ€™t figure out how to implement the fix.

I have my typeahead that is initialized as a (document).ready function

 $('#myTextbox').typeahead({ name: 'Typeahead', valueKey: "Value", remote: '/ServiceHandlers/myHandler.ashx?Method=Typeahead&Query=%QUERY', template: ['<p>{{Value}}</p>'], engine: Hogan }); 

The question says add something like

 $('.typeahead').typeahead('setQuery', ''); 

But I canโ€™t figure out where this will go. Any suggestions to fix this problem?

+4
source share
1 answer

It revealed!

Just needed to install

 $('#myTextbox').typeahead('setQuery', $(#myTextbox).val()); 

in typeahead.open function.

+9
source

Source: https://habr.com/ru/post/1484942/


All Articles