
Lab 23 was about creating a webpage with a form with checkboxes the user can check all at once by holding the shift key. In the HTML, I created a div with <input> tags inside, the type attribute set to checkbox. Doing this multiple times created a list of checkboxes, you couldn't select multiple by holding shift just yet. To do this, we first set a variable, checkbox, equal to the checkbox element and another variable, inBetween, to false. Then we create a function handleCheck, that checks if the user has both clicked a checkbox and held down shift via if statement. If so, the function will loop through all the checkboxes that came before the checkbox the user just clicked and after the box the user previously clicked, set inBetween true for these boxes, and check them. Thus, shift-clicking multiple boxes at once becomes an available feature.
These skills are important for a web designer because they make the user's experience more convenient. If a site contains multiple items the user can select, like items in a shopping cart, having to select multiple at once can be tedious without shift-clicking. However, giving them the ability to select multiple items at once via shift-click makes this easier for the user. It reduces frustration, enhances the experience, and keeps the user coming back.
Comments
Post a Comment