typeahead.js get selected datum
typeahead, typeahead.js
Solution
After selection, so you need `typeahead:selected`:
$('.selector').typeahead({
name: 'identifier',
local: localObjectsArray
}).on('typeahead:selected', function (obj, datum) {
console.log(obj);
console.log(datum);
});
Hope it helps.
Problem
I'm trying to use Twitter typeahead.js to return a datum after selection. From what I understood by the documentation the code should look something like ``` $('.selector').typeahead({ name: 'identifier', local: localObjectsArray }).on('autocompleted', function(item){ alert(JSON.stringify(item)); }); ``` However this doesn't work. What's the proper way to detect typeahead events?