Lab 23: Hold Shift and Check Checkboxes

Link to Lab 23:

In this lab, we were assigned to work with this checklist and make it so it would check when clicked as well as when you hold shift, all the boxes in between will also be checked. The technical side of this lab which is the more important is that there are three parts of code: the code that checks if the person in checking, the code to determine if the shift key is being pressed, and the code that makes it so the boxes in between are checked as well.
Most of the code relies on an if statement that is performed with the shift key is being pressed and when the box is checked. Some of the code includes:

if(e.shiftKey && this.checked){
//loop over every check box
checkboxes.forEach(checkbox =>{
if(checkbox === this || checkbox === lastChecked){
inBetween = !inBetween;
console.log('staring to check them inbetween');
}




Comments

Popular posts from this blog

Lab 23-2: Type Ahead

WBL Workshop 2

Lab7 - Simple Accordion