bootstrap-typeahead.js add a listener on select event
Solution 1:
you should use "updater":
$('#search-box').typeahead({
source: ["foo", "bar"],
updater:function (item) {
//item = selected item
//do your stuff.
//dont forget to return the item to reflect them into input
return item;
}
});
Solution 2:
In v3 twitter bootstrap typeahead will be dropped an replaced with the twitter typeahead (which has the feature you want to and a lot more)
https://github.com/twitter/typeahead.js
usage like this:
jQuery('#autocomplete-input').on('typeahead:selected', function (e, datum) {
console.log(datum);
});
Solution 3:
you can use afterSelect
$('#someinput').typeahead({
source: ['test1', 'test2'],
afterSelect: function (item) {
// do what is needed with item
//and then, for example ,focus on some other control
$("#someelementID").focus();
}
});