forked from cheton/jquery-checkboxset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
62 lines (58 loc) · 2.3 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
<!DOCTYPE html>
<html>
<head>
<title>Checkbox Set</title>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
<meta charset="utf-8" />
</head>
<body>
<h1>Checkbox Set</h1>
<ul id="checkboxset">
<li><input type="checkbox" id="chk_items" name="chk_items"><label for="chk_items">Check all items</label></li>
<hr/>
<li><input type="checkbox" id="chk_item_1" name="chk_item_1"><label for="chk_item_1">Item 1</label>
<ul style="padding-left: 20px;">
<li><input type="checkbox" id="chk_item_1_1" name="chk_item_1_1"><label for="chk_item_1_1">Item 1_1</label></li>
<li><input type="checkbox" id="chk_item_1_2" name="chk_item_1_2"><label for="chk_item_1_2">Item 1_2</label></li>
<ul style="padding-left: 20px;">
<li><input type="checkbox" id="chk_item_1_2_1" name="chk_item_1_2_1"><label for="chk_item_1_2_1">Item 1_2_1</label></li>
<li><input type="checkbox" id="chk_item_1_2_2" name="chk_item_1_2_2"><label for="chk_item_1_2_2">Item 1_2_2</label></li>
</ul>
</ul>
</li>
<li><input type="checkbox" id="chk_item_2" name="chk_item_2"><label for="chk_item_2">Item 2</label></li>
<li><input type="checkbox" id="chk_item_3" name="chk_item_3"><label for="chk_item_3">Item 3</label></li>
</ul>
<script src="jquery-1.4.4.min.js"></script>
<script src="jquery.checkboxset-1.0.js"></script>
<script>
var checkboxset = $("#checkboxset").checkboxset({
tristate : true,
data : {
"chk_items" : {
"chk_item_1" : {
"chk_item_1_1" : { checked : true },
"chk_item_1_2" : {
"chk_item_1_2_1" : { checked : true },
"chk_item_1_2_2" : { checked : false }
}
},
"chk_item_2" : { checked : false },
"chk_item_3" : { checked : true }
}
},
change : function(name) {
if ($.browser.mozilla) {
console.log(name + " checked");
}
}
});
if ($.browser.mozilla) {
console.log(checkboxset.checked("chk_item_1_1"));
console.log(checkboxset.checked("chk_item_1_2"));
console.log(checkboxset.indeterminate("chk_item_1_1"));
console.log(checkboxset.indeterminate("chk_item_1_2"));
}
</script>
</body>
</html>