forked from jharding/typeahead.js-bootstrap.css
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
73 lines (73 loc) · 2.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html>
<head>
<title>Typehead & Bootstrap</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.9.3/typeahead.min.js"></script>
<link href="typeahead.js-bootstrap.css" rel="stylesheet">
<script type="text/javascript">
var data = [
'Salt Lake City',
'Provo',
'Ogden',
'Bountiful',
'Orem',
'Centerville',
'St. George',
'Cedar City',
'Hurricane',
];
$(document).ready(function() {
$('#choose').text(data.join(', '));
$('#typeahead-1').typeahead({
name: 'normal',
local: data
});
$('#typeahead-2').typeahead({
name: 'addon',
local: data
});
$('#typeahead-3').typeahead({
name: 'pre-addon',
local: data
});
});
</script>
</head>
<body>
<div class="container">
<h1 class="page-header">typeahead.js and Bootstrap 3 example</h1>
<p>Choose from: <span id="choose"></span></p>
<div class="row">
<div class="col-xs-12">
<h2>Normal</h2>
<div class="input-group col-sm-3">
<input type="text" class="form-control" id="typeahead-1" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Addon</h2>
<p>This is more complex because of CSS's inability to select a parent. add <code>input-group-appended</code> to the container div</p>
<div class="input-group input-group-appended col-sm-3">
<input type="text" class="form-control" id="typeahead-2" />
<span class="input-group-addon">#</span>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h2>Pre-addon aka Prepend</h2>
<p>Prepending an input group is easier because of CSS's sibling select <code>+</code></p>
<div class="input-group col-sm-3">
<span class="input-group-addon">#</span>
<input type="text" class="form-control" id="typeahead-3" />
</div>
</div>
</div>
</div>
</body>
</html>