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 38f53ba commit bf0652dCopy full SHA for bf0652d
10 - Hold Shift and Check Checkboxes/index-START.html
@@ -99,6 +99,27 @@
99
</div>
100
101
<script>
102
+const checkboxes = document.querySelectorAll('.input input[type=checkbox]');
103
+let lastChecked;
104
+
105
+function handleCheck (e) {
106
+ let inBetween = false;
107
+ if (e.shiftKey && this.checked) {
108
+ checkboxes.forEach(checkbox => {
109
+ if (checkbox === this || checkbox === lastChecked) {
110
+ inBetween = !inBetween;
111
+ }
112
113
+ if (inBetween) {
114
+ checkbox.checked = true;
115
116
+ });
117
118
119
+ lastChecked = this;
120
+}
121
122
+checkboxes.forEach(checkbox => addEventListener('click', handleCheck));
123
</script>
124
</body>
125
</html>
0 commit comments