jquery - 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);
});
解决方案
我已经通过更新 typeahead 解决了这个问题,上面的代码在更新后运行良好。
推荐阅读
- amazon-web-services - cloudformation 多重 if 条件
- python - 如何使用存档获取网页的所有损坏链接?
- android - 无法在自定义 Rom [Android 11 (Rooted-Magisk)] 上执行颤振运行和 adb 安装/卸载
- firebase-cloud-messaging - 生成代码以获取 fcm 推送通知的刷新令牌的范围应该是什么?
- javascript - 如何自动归档输入框并单击搜索按钮?
- json - 获取返回对象类型的 JSON Schema
- java - Qt从java Activity调用c++方法
- .net - .NET 迁移默认为主数据库
- sql - SQL - FROM(子查询)和 WHERE - IN(子查询)之间的区别
- python - 有没有办法使用 pyopenssl 或密码学或任何其他库检查 CRL 编号和颁发者名称哈希?