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 92d0b20 commit dd23620Copy full SHA for dd23620
10 - Hold Shift and Check Checkboxes/index-START.html
@@ -104,6 +104,29 @@
104
</div>
105
106
<script>
107
+
108
+ const items = document.querySelectorAll('input[type="checkbox"]');
109
+ let lastChecked;
110
+ function handleClick(e) {
111
+ let inbetween = false;
112
113
+ if (e.shiftKey && this.checked){
114
+ items.forEach(item => {
115
+ if ((item === this || item === lastChecked) && lastChecked) {
116
+ inbetween = !inbetween;
117
+ }
118
119
+ if (inbetween) {
120
121
+ item.checked = true;
122
123
124
+ })
125
+ };
126
+ lastChecked = this;
127
128
+ items.forEach(item => item.addEventListener('click', handleClick));
129
130
</script>
131
</body>
132
</html>
0 commit comments