Possible Duplicate:
bootstrap-typeahead.js add a listener on select event
I'm using Twitter Bootstrap's typeahead functionality, and I want to use .on('change', function(){...})
, but my problem is, the event fires before the value of the input actually changes to the one selected, and when the function is called, the $(this).val()
inside the function returns the value that was there before the change. The event fires twice, but only the second one should.
I need a way to run the function in a way so it returns the selected value, and runs only once.
jsFiddle