Jquery typeahead.js不会触发源函数
我正在尝试集成twitter typeahead.js,为此我从下载了这个库,并包含了Jquery typeahead.js不会触发源函数,jquery,twitter-bootstrap-3,typeahead,twitter-typeahead,Jquery,Twitter Bootstrap 3,Typeahead,Twitter Typeahead,我正在尝试集成twitter typeahead.js,为此我从下载了这个库,并包含了typeahead.bundle.min.js 然后我添加了以下内容 <input type="text" class="form-control typeahead font-normal"> $('.typeahead').typeahead({ source: function(query, process) { console.log(query); } })
typeahead.bundle.min.js
然后我添加了以下内容
<input type="text" class="form-control typeahead font-normal">
$('.typeahead').typeahead({
source: function(query, process) {
console.log(query);
}
});
它是有效的。试试这个,
您必须添加引导类型
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.js"></script>
JSFIDLE同样适用
你说得对,现在触发了,但是当我尝试返回JSON对象时,它没有显示,如何显示结果?我知道了,更新了问题以供参考。谢谢。这里还有另一个“维护”版本的typeahead.js。。。
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.js"></script>