This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.html
56 lines (48 loc) · 1.75 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheets/reset.css">
<link rel="stylesheet" type="text/css" href="stylesheets/typography.css">
<link rel="stylesheet" type="text/css" href="stylesheets/autocomplete.css">
<title>Practical Object-Oriented JavaScript</title>
</head>
<body>
<h1>Practical Object-Oriented JavaScript</h1>
<hr/>
<h2>Local Autocomplete</h2>
<input type="text" name="local_autocomplete" id="local-autocomplete-field" />
<br />
<h2>AJAX Autocomplete</h2>
<input type="text" name="ajax_autocomplete" id="ajax-autocomplete-field" />
<script src="/js/vendor/jquery.min.js"></script>
<script src="/js/vendor/lodash.min.js"></script>
<script src="/js/autocomplete_input.js"></script>
<script src="/js/autocomplete_list_item.js"></script>
<script src="/js/autocomplete_list.js"></script>
<script src="/js/autocomplete_local_adapter.js"></script>
<script src="/js/autocomplete_ajax_adapter.js"></script>
<script src="/js/autocomplete.js"></script>
<script type="text/javascript">
var localAutocompleteInstance = new Autocomplete({
selector: "#local-autocomplete-field",
items: [
{ value: 1, text: "Apples" },
{ value: 2, text: "Bananas" },
{ value: 3, text: "Carrots" },
{ value: 4, text: "Capers" },
{ value: 5, text: "Corn" }
],
onAutocomplete: function(item) {
console.log(item);
}
});
var ajaxAutocompleteInstance = new Autocomplete({
selector: "#ajax-autocomplete-field",
url: "fruits",
onAutocomplete: function(item) {
console.log(item);
}
});
</script>
</body>
</html>