我正在使用twitter typeahead而且我无法绑定select事件。我已经看到几乎与此相关的一切,但它还没有奏效。
var subjects = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5', 'CSS3', 'JSON'];
$('#search').typeahead({
source: subjects
});
$('#search').bind('typeahead:select', function (ev, suggestion) {
console.log('Selection: ' + suggestion);
});
我通过更新typeahead解决了这个问题,上面的代码在更新后运行良好。