-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkbox.html
34 lines (29 loc) · 933 Bytes
/
checkbox.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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>DAM checkbox demo</title>
</head>
<body>
<h1>DAM checkbox demo</h1>
<p>DAM comes with a checkbox widget. This widget simply bundles together a checkbox input
(on the left) with a label (on the right).</p>
<div id="installation"></div>
<script src="../dist/dam-plus-widgets-0.2.js"></script>
<script>
var div=DAM.maker('div'), span=DAM.maker('span');
var understood = false;
var great = false;
var statusBar = span();
function updateStatus() {
statusBar.textContent = (understood ? "understood " : "") + (great ? "great " : "");
}
var d = div(
div(
DAM.makeCheckbox({ onchange: function(b) { understood = b; updateStatus(); } }, "I understand"),
DAM.makeCheckbox({ onchange: function(b) { great = b; updateStatus(); } }, "It's great")
),
statusBar
);
document.getElementById('installation').appendChild(d);
</script>
</body>