twitter / typeahead.js

typeahead.js is a fast and fully-featured autocomplete library
http://twitter.github.io/typeahead.js/
MIT License
16.52k stars 3.21k forks source link

input value change in Microsoft Edge #1757

Open mohas opened 5 years ago

mohas commented 5 years ago

Hi, as you can see in this Fiddle when running in Microsoft Edge when I type d then select the dog item, value of the input is not changed, is this a bug or am I doing something wrong?

labilbe commented 5 years ago

Same problem with IE11.

labilbe commented 5 years ago

You should use $('.typeahead').on('typeahead:change') instead of change event. See this Fiddle.

From documentation

typeahead:change – Normalized version of the native change event. Fired when input loses focus and the value has changed since it originally received focus.

mohas commented 5 years ago

For those who need to fix this issue by changing typeahead source code you just need to add a .trigger('change') to this line after value is set. change it to: this.$input.val(value).trigger('change'); it should not have any side effects at least in modern browsers.