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?