-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjq-alfa-checkbox.html
More file actions
106 lines (86 loc) · 3.49 KB
/
jq-alfa-checkbox.html
File metadata and controls
106 lines (86 loc) · 3.49 KB
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<style>
body { font-family: Tahoma; margin: 20px 50px; }
h1, h2, h3 { font-weight: normal; }
</style>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script>
<script src="jq-alfa-checkbox.js"></script>
<title>alfa-checkbox</title>
<style id="alfa-checkbox-override">
/* override default style */
.alfa-checkbox, .alfa-checkbox label {
width: 20px !important;
height: 20px !important;
}
.alfa-checkbox label {
background: #ffdc7d !important; /* box background color */
}
.alfa-checkbox label:after {
border-color: lime !important; /* checkmark color */
}
.alfa-checkbox input[disabled] ~ label {
border-color: red !important;
background: #808080 !important;
}
</style>
</head>
<body>
<h2>jq-alfa-checkbox.js</h2>
<p style="font-size:.8em;">
<form method="post" > using this plugin, sends data from ALL checkboxes as string "true or "false" <br />
default behaviour of <input type="checkbox" > sends ONLY checked items as string "on" loosing data of unchecked items
</p>
<form style="border:1px solid silver; padding:10px;">
data field 1 <input type="checkbox" class="alfa-checkbox" name="dataField1" /><br /><br />
data field 2 <input type="checkbox" class="alfa-checkbox" name="dataField2" disabled /> disabled<br /><br />
<label for="dataField3">data field 3 </label><input type="checkbox" class="alfa-checkbox" name="dataField3" />
<label for="dataField4">data field 4 </label><input type="checkbox" class="alfa-checkbox" name="dataField4" /> (with <label> tag)<br /><br />
<input type="checkbox" class="alfa-checkbox" name="dataField5" /> data field 5 <br /><br />
<input type="checkbox" class="alfa-checkbox" name="dataField6" /> data field 6 <br /><br />
<button type="submit">submit</button>
</form>
<script>
$(document).ready(function () {
$.alfaCheckbox('.alfa-checkbox', {
onChange: function () { formDirty = true; $('button[type=submit]').show(); }
});
});
</script>
<br /><br />
dataField1 <a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField1', { set: true });
})()
">set true</a>
<a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField1', { set: false });
})()
">set false</a><br /><br />
dataField2 <a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField2', { set: true });
})()
">set true</a>
<a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField2', { set: false });
})()
">set false</a> (disabled)<br /><br />
dataField3 <a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField3', { set: true });
})()
">set true</a>
<a href="#" onclick="
(function () {
$.alfaCheckbox('#dataField3', { set: false });
})()
">set false</a>
<br><br><br><br>
see alfalabs <a href="https://github.com/alfalabs/alfa-checkbox">github repository</a> for this project.
</body>
</html>