forked from DanmarksAdresser/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
59 lines (52 loc) · 1.9 KB
/
demo.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
<!doctype html>
<html>
<meta charset="utf-8">
<head>
<title>DAWA autocomplete demo</title>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="bower_components/jquery-ui/themes/start/jquery-ui.css">
<link rel="stylesheet" href="bower_components/jquery-ui/themes/start/theme.css">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<script src="bower_components/jquery-ui/ui/autocomplete.js"></script>
<script src="dawa-autocomplete.js"></script>
<body>
<p><label for="adresse-autocomplete">Autocomplete af adresse</label></p>
<input type="text" id="adresse-autocomplete" style="width: 400px;">
<p>Valgt adresse: <span id="adresse-choice"></span></p>
<hr>
<p><label for="adgangsadresse-autocomplete">Autocomplete af adgangsadresse</label></p>
<input type="text" id="adgangsadresse-autocomplete" style="width: 400px;">
<p>Valgt adgangsadresse: <span id="adgangsadresse-choice"></span></p>
<hr>
<p><label for="adresse-autocomplete-kbh">Autocomplete af adresse i københavn</label></p>
<input type="text" id="adresse-autocomplete-kbh" style="width: 400px;">
<p>Valgt adresse: <span id="adresse-choice-kbh"></span></p>
<hr>
</body>
<script>
$('#adresse-autocomplete').dawaautocomplete({
select: function(event, data) {
$('#adresse-choice').text(data.tekst);
},
error: function(xhr, status, error) {
alert('Der opstod en fejl: ' + status + " - " + error);
}
});
$('#adgangsadresse-autocomplete').dawaautocomplete({
adgangsadresserOnly: true,
select: function(event, data) {
$('#adgangsadresse-choice').text(data.tekst);
}
});
$('#adresse-autocomplete-kbh').dawaautocomplete({
params: {
kommunekode: 101
},
select: function(event, data) {
$('#adresse-choice-kbh').text(data.tekst);
}
});
</script>
</html>