Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05b35f4 commit 53bb0a9Copy full SHA for 53bb0a9
10 - Hold Shift and Check Checkboxes/index-START.html
@@ -99,6 +99,25 @@
99
</div>
100
101
<script>
102
+ const boxes = document.querySelectorAll('input');
103
+ let inBetween = false;
104
+ let lastChecked
105
+
106
+ function selectBox(e) {
107
+ if(e.shiftKey && this.checked) {
108
+ boxes.forEach(box => {
109
+ if(box === this || box === lastChecked) {
110
+ inBetween = !inBetween;
111
+ }
112
+ if(inBetween) {
113
+ box.setAttribute('checked','true');
114
115
+ });
116
117
+ lastChecked = this;
118
+ };
119
120
+ boxes.forEach(box => box.addEventListener('click',selectBox));
121
</script>
122
</body>
123
</html>
0 commit comments