1 回答
TA贡献1911条经验 获得超7个赞
const states = [
"Alabama",
"Alaska",
"Arizona",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida"
];
$("#the-basics .typeahead").typeahead({
hint: true,
highlight: true,
minLength: 1,
name: "states",
source: states
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<div class="container">
<div id="the-basics">
<input class="typeahead" type="text" placeholder="States of USA" autocomplete="off">
</div>
</div>
添加回答
举报