-
Notifications
You must be signed in to change notification settings - Fork 16
/
demo.html
50 lines (50 loc) · 1.5 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Tagger Example</title>
<link href="tagger.css" rel="stylesheet">
<style>
.tagger + .tagger {
margin-top: 10px;
}
</style>
</head>
<body>
<h1>Tagger Example</h1>
<input type="text" value="charles,louis,michel" name="tags" />
<input type="text" value="charles,louis,michel" name="tags2" />
<input type="text" value="charles,louis,michel" name="tags3a" />
<input type="text" value="charles,louis,michel,lorem,ipsum,dolor,sit,amet,this is some long tag that should be wrapped" name="tags3b" />
<script src="tagger.js"></script>
<script>
var t1 = tagger(document.querySelector('[name="tags"]'), {
allow_duplicates: false,
allow_spaces: true,
add_on_blur: true,
tag_limit: 4,
completion: {list: ['foo', 'bar', 'baz']}
});
var t2 = tagger(document.querySelector('[name="tags2"]'), {
allow_duplicates: false,
allow_spaces: true,
completion: {
list: function() {
return Promise.resolve(['foo', 'bar', 'baz', 'foo-baz']);
}
},
link: function() { return false; }
});
var t3 = tagger(document.querySelectorAll('[name^="tags3"]'), {
allow_duplicates: false,
allow_spaces: true,
wrap: true,
link: function(name) {
return `javascript:alert('${name}');`;
}
});
</script>
</body>
</html>