Skip to content

Commit f383a36

Browse files
committed
Track last clicked box even if not shift clicked
1 parent bc180a0 commit f383a36

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

10 - Hold Shift and Check Checkboxes/my-index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@
109109

110110
checkboxes.forEach(checkbox => checkbox.addEventListener('click', bulkCheck));
111111
function bulkCheck(event) {
112-
if (!lastClicked) {lastClicked = this;}
112+
if (!lastClicked || !event.shiftKey) {lastClicked = this; return;}
113113
// console.log(event.shiftKey);
114-
if (!event.shiftKey) {return}
115114
const lastClickedIdx = checkboxes.indexOf(lastClicked);
116115
const currentIdx = checkboxes.indexOf(this);
117116
const boxesToCheck = checkboxes.slice(

0 commit comments

Comments
 (0)