This repository was archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
113 lines (103 loc) · 5.46 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
<title>mab.jquery.taginput Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="all" href="lib/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" media="all" href="mab-jquery-taginput.css" />
<style type="text/css">
.narrow {
width: 300px !important;
}
</style>
</head>
<body>
<div class="container">
<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">mab.jquery.taginput Demo</a>
</div>
</div>
<form action="" method="post" role="form">
<div class="form-group">
<label for="tags0">Empty</label>
<input type="text" class="form-control tag-input" name="tags0" id="tags0" value="">
</div>
<div class="form-group">
<label for="tags1">Empty with placeholder</label>
<input type="text" class="form-control tag-input" name="tags1" id="tags1" placeholder="Enter tags" value="">
</div>
<div class="form-group">
<label for="tags2">Pre-populated</label>
<input type="text" class="form-control tag-input" name="tags2" id="tags2" placeholder="Enter tags" value="cat|dog|catfish|fish">
</div>
<div class="form-group">
<label for="tags2">Multi-line</label>
<input type="text" class="form-control tag-input narrow" name="tags3" id="tags3" placeholder="Enter tags" value="cat|catfish|dog|dogfish|fish">
</div>
<div class="form-group">
<label for="tags2">No typeahead</label>
<input type="text" class="form-control tag-input-basic" name="tags4" id="tags4" placeholder="Enter tags" value="">
</div>
<div class="form-group">
<label for="tags2">Callback data</label>
<pre id="console">Add or remove a tag from one of the inputs above...
</pre>
</div>
</form>
</div> <!-- /container -->
<a href="https://github.com/markashleybell/mab.jquery.taginput"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<script type="text/javascript" src="lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="lib/js/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/js/typeahead.bundle.min.js"></script>
<script type="text/javascript" src="mab-jquery-taginput.js"></script>
<script type="text/javascript">
$(function(){
// Instantiate the Bloodhound suggestion engine
var tags = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.tag); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ tag: 'dog' },
{ tag: 'cat' },
{ tag: 'fish' },
{ tag: 'catfish' },
{ tag: 'dogfish' }
]
});
tags.initialize();
// Set up an on-screen console for the demo
var screenConsole = $('#console');
// Write callback data to the screen when tags are added or removed in demo inputs
var logCallbackDataToConsole = function(added, removed) {
screenConsole.append('Tag Data: ' + (this.val() || null) + ', Added: ' + added + ', Removed: ' + removed + '\n');
};
// Create typeahead-enabled tag inputs
$('.tag-input').tagInput({
allowDuplicates: false,
typeahead: true,
typeaheadOptions: {
highlight: true
},
typeaheadDatasetOptions: {
display: function(d) { return d.tag; },
source: tags.ttAdapter()
},
onTagDataChanged: logCallbackDataToConsole
});
// Create basic tag inputs with no typeahead
$('.tag-input-basic').tagInput({
onTagDataChanged: logCallbackDataToConsole
});
$('#results a[rel="external"]').attr('target', '_blank');
});
</script>
</body>
</html>