<div class="well">
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source="["Ahmedabad","Akola","Asansol","Aurangabad","Bangaluru","Baroda","Belgaon","Berhumpur","Calicut","Chennai","Chapra","Cherapunji"]">
</div>
我已添加内联数据源。
检查此小提琴链接:http://jsfiddle.net/5WjHR/
它不会自动填写输入框中的数据。
Typeahead JS&amp; Bootstrap CSS已作为外部资源添加到小提琴中。
答案 0 :(得分:1)
必须使用单引号和双引号组合,否则必须对它们进行转义。
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source='["Ahmedabad","Akola","Asansol","Aurangabad","Bangaluru","Baroda","Belgaon","Berhumpur","Calicut","Chennai","Chapra","Cherapunji"]'>
答案 1 :(得分:1)
将数据源双引号更改为单引号应该有效:)
http://jsfiddle.net/aamir/5WjHR/1/
data-source='["Ahmedabad","Akola","Asansol","Aurangabad","Bangaluru","Baroda","Belgaon","Berhumpur","Calicut","Chennai","Chapra","Cherapunji"]'