twitter/typeahead.js — pull request #58 by justindarc (2013-02-27 06:36:11+00:00)
Title: Resolved Issue #22 - Added 'selection' callback and event

Added a selection callback:

```javascript
$('.example-countries .typeahead').typeahead({
name: 'countries',
prefetch: '../data/countries.json',
limit: 10,
selectionCallback: function(query, selectedItem) {
console.log(query, selectedItem);
}
});
```

Also, added a 'selection' event:

```javascript
$('.example-twitter-oss .typeahead').typeahead({
name: 'twitter-oss',
prefetch: '../data/repos.json',
template: [
'

{{language}}

',
'

{{name}}

',
'

{{description}}

'
].join(''),
engine: Hogan
});

$('.example-twitter-oss .typeahead').bind('selection', function(evt) {
console.log(evt.query, evt.selectedItem);
});
```