Skip to content

Commit 0f49f28

Browse files
committed
all checkbox
1 parent 751b05d commit 0f49f28

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

10_checkbox _challenge/index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@
9494
</div>
9595
</div>
9696

97-
<script></script>
97+
<script>
98+
const checkboxes = document.querySelectorAll(
99+
'.inbox input[type ="checkbox"]'
100+
);
101+
let lastChecked;
102+
function handleCheck(event) {
103+
let inBetween = false;
104+
if (event.shiftKey && this.checked) {
105+
checkboxes.forEach(checkbox => {
106+
console.log(checkbox);
107+
});g
108+
}
109+
lastChecked = this;
110+
}
111+
checkboxes.forEach(checkbox =>
112+
checkbox.addEventListener("click", handleCheck)
113+
);
114+
</script>
98115
</body>
99116
</html>

0 commit comments

Comments
 (0)