Jquery 自动完成值不显示

Jquery 自动完成值不显示,jquery,twitter-bootstrap-3,typeahead.js,Jquery,Twitter Bootstrap 3,Typeahead.js,我关注以下网站: 我将输入文本创建为: <div class="col-xs-2"> <input type="text" class="form-control typeahead" name="user" id="user" placeholder="autocomplete" /> </div> 我没有错误,但没有列表显示。我调试代码,调用了函数typeahead 你有主意吗 谢谢你没有正确调用插件。它需要一个对象作为选项,并且源是项目之一 试

我关注以下网站:

我将输入文本创建为:

<div class="col-xs-2">
    <input type="text" class="form-control typeahead" name="user" id="user" placeholder="autocomplete" />
</div>
我没有错误,但没有列表显示。我调试代码,调用了函数typeahead

你有主意吗


谢谢你没有正确调用插件。它需要一个对象作为选项,并且源是项目之一

试试这个:

 var typeaheadSource = ['John', 'Alex', 'Terry'];
 $('.typeahead').typeahead({source: typeaheadSource});
好的,我忘记了typeahead函数的属性“source”。现在我在ont-typeahead.js上遇到了这个错误:Uncaught-TypeError:无法读取未定义的属性'hasOwnProperty'
 var typeaheadSource = ['John', 'Alex', 'Terry'];
 $('.typeahead').typeahead({source: typeaheadSource});