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 9ec7892 commit d3feeb4Copy full SHA for d3feeb4
10 - Hold Shift and Check Checkboxes/index-START.html
@@ -96,6 +96,34 @@
96
</div>
97
98
<script>
99
+ const checkboxes = document.querySelectorAll('.inbox input[type="checkbox"]');
100
+ let lastCheck;
101
+
102
+ function doCheck(e) {
103
104
+ let inBetween = false;
105
+ if (this.checked && e.shiftKey) {
106
107
+ checkboxes.forEach(checkbox => {
108
109
+ if (checkbox === this || checkbox === lastCheck) {
110
+ inBetween = !inBetween;
111
+ }
112
113
+ if (inBetween) {
114
+ checkbox.checked = true;
115
116
117
118
+ })
119
120
+ lastCheck = this;
121
122
123
124
+ checkboxes.forEach(checkbox => checkbox.addEventListener('click', doCheck));
125
126
127
</script>
128
</body>
129
</html>
0 commit comments