Recap
Housekeeping
1. Spoiler Demo
Materials
2. Introduction to Events
Materials
- Starter code: Spoilers from Function Refactor session
Breakout Activity
In pairs: Try to repeat what Tony did in his demo
- Pick one of the functions from today's spoilers
- Goal: refactor the code so that the prompt(s) start on a button click
- Create a button element
- Assign that element to a variable with
document.querySelector()
- Wrap the prompt code into a
clickHandler
function.
- Add that function as a button click event using
button.addEventListener()
3. More events and elements
Lab Time
Main Room: Dark Mode Toggle
Prep
Events and Element.addEventListener()
- MDN Readings:
- Video by Steve Griffith
Changing CSS with JS