forked from rixth/bubbleBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
47 lines (45 loc) · 1.47 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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Bubble Box test</title>
<link rel="stylesheet" href="./src/bubbleBox.css" />
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
#bubbleBox_list {
width: 200px;
}
</style>
</head>
<body>
<ul id="bubbleBox_list"></ul><input id="bubbleBox" type="text" />
<p>This demo of bubbleBox only supports entering email addresses.</p>
<pre id="debug_log"></pre>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<script type="text/javascript" src="./src/jquery.bubbleBox.js"></script>
<script type="text/javascript">
function debug(what) {
$('#debug_log').append(what + "<br/>");
}
$('#bubbleBox').bubbleBox({
beforeAdd: function (event, data) {
if (!data.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)) {
debug('FAILED: not a valid email address');
return false;
}
},
afterAdd: function (event, data) {
debug('added item '+ data.value);
},
remove: function (event, data) {
debug('remove item '+ data.value);
}
});
</script>
</body>
</html>