forked from varvet/tiny-autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
35 lines (33 loc) · 1.08 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
<html>
<head>
<title>Autocomplete</title>
<link rel="stylesheet" href="css/tiny-autocomplete.css" />
<link rel="stylesheet" href="css/autocomplete-demos.css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
</head>
<body>
<h1>Tiny-autocomplete demo (flat)</h1>
<input id="autocomplete-0" type="text" name="autocomplete-0" />
<div class="results"></div>
<script src="lib/zepto.js"></script>
<script src="src/tiny-autocomplete.js"></script>
<script>
$('#autocomplete-0').tinyAutocomplete({
url: '/data/flat.json',
maxItems: 7,
showNoResults: true,
onSelect: function(el, val) {
if(val == null) {
$('.results').html('All results for "' + $(this).val() + '"" would go here');
}
else {
$(this).val( val.title );
$('.results').html('<h1>' + val.title + '</h1>');
}
}
});
</script>
</body>
</html>