我正在尝试将Twitter的Typeahead框用于文本字段,这样我最终可以将其用于与Google地图api数据库一致的自动完成功能。我甚至无法用一堆样本值来下载该框,我不知道我做错了什么。
jQuery的:
$(document).ready(function(){
$('#autocomplete .typeahead').typeahead({
name: 'accounts',
local: ['Audi', 'BMW', 'Bugatti', 'Ferrari', 'Ford', 'Lamborghini', 'Mercedes Benz', 'Porsche', 'Rolls-Royce', 'Volkswagen']
});
});
HTML:
<div class="col-sm-12" id = "filters" style="height:75px;">
<div class="col-sm-3" id = "search">
<form class="navbar-form">
<div class="form-group" style="display:inline;">
<div class="input-group">
<input type="text" placeholder="City/State/Zip" class="typeahead" id = "autocomplete">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
</div>
</div>
</form>
</div>
</div>
答案 0 :(得分:0)
尝试将您的ID重新安排回div字段,使用您的html执行此操作:
<div class="col-sm-12" id = "filters" style="height:75px;">
<div class="col-sm-3" id = "search">
<form class="navbar-form">
<div class="form-group" style="display:inline;">
<div class="input-group" id="autocomplete">
<input type="text" placeholder="City/State/Zip" class="typeahead">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
</div>
</div>
</form>
</div>
</div>