首页 > 解决方案 > jquery bootstrap typeahead 无法绑定事件

问题描述

我正在使用 twitter typeahead,我无法绑定选择事件。我已经看到了与此相关的几乎所有内容,但它还不起作用。

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);
});

标签: jquerytwitter-bootstraptypeahead

解决方案


我已经通过更新 typeahead 解决了这个问题,上面的代码在更新后运行良好。


推荐阅读