Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery typeahead.js不会触发源函数_Jquery_Twitter Bootstrap 3_Typeahead_Twitter Typeahead - Fatal编程技术网

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

我正在尝试集成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);
    }
});
它是有效的。

试试这个, 您必须添加引导类型

<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>