Bootstrap 3 and typeahead.js
Simple example of Bootstrap 3 and typeahead.js
by Christopher Brooks
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.0/bootstrap.min.js"></script>
<script src="http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js"></script>
<div class="row">
<div class="col-lg-2">
<div class="panel">
<fieldset>
<div class="form-group">
<input type="text" class="form-control" id="exampleInput1" placeholder="Example 1">
</div>
<div class="form-group">
<input type="text" class="form-control" id="exampleInput2" placeholder="Example 2">
</div>
</fieldset>
</div>
</div>
</div>
CSS
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
JavaScript
$('#exampleInput2').typeahead(null, {
displayKey: function(str) { return str; },
source: function(query, cb) {
cb(new Array('test1', 'test2'));
}
});