-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
75 lines (66 loc) · 2.36 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<title>A simple select plugin</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link media="all" rel="stylesheet" type="text/css" href="styles/simple-select.css" />
<style type="text/css" media="all">
body {
margin: 0;
padding: 0;
}
.wrapper {
width: 400px;
margin: 50px auto;
}
</style>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="node_modules/simple-module/lib/module.js"></script>
<script type="text/javascript" src="dist/simple-select.js"></script>
<script type="text/javascript">
$(function() {
var selectOne = simple.select({
el: $('#select-one'),
placeholder: 'type sth...',
noWrap: false
});
selectOne.on('change', function(e, selection) {
console.log(selection, selectOne.el.val());
});
var selectTwo = simple.select({
el: $('#select-two')
});
selectTwo.on('change', function(e, selection) {
console.log(selection, selectTwo.el.val());
});
});
</script>
</head>
<body>
<div class="wrapper">
<div class="demo-one">
<h3>Demo one: single select</h3>
<select id="select-one">
<optgroup label="Swedish Cars">
<option value="volvo" data-hint="car 1">Volvo</option>
<option value="saab" data-hint="car 2">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes" data-hint="car 3">Mercedes</option>
<option value="audi" data-hint="car 4" selected>Audi</option>
</optgroup>
</select>
</div>
<div class="demo-two">
<h3>Demo Two: multiple select</h3>
<select id="select-two" multiple="true">
<option value="">select something</option>
<option value="0" data-key="George Washington" selected>George Washington</option>
<option value="1" data-key="John Adams">John Adams</option>
<option value="2" data-key="Thomas Jefferson">Thomas Jefferson</option>
</select>
</div>
</div>
</body>
</html>