DOM Elements and Page Output
Recap
Housekeeping
- Friday afternoon:
- Ash/Tony pair-code session -> WBDV Dark Mode Toggle
- Updated Schedule
clickHandler
Overview
1. Materials
2. Form field variables with DOM output
Materials
Demo: GST Calculator with Form
- Gist: JS Activity - Form fields and DOM output
- Starter Code: 01-clickhandler-starter
Breakout Activity
In pairs: Try to repeat what Tony did in his demo
- Pick one of the functions from today's spoilers
- Goal: Create a fully functional form that takes input from a form field and outputs to the page.
- Follow the instructions on this page.
3. Demo: Vanilla JS Dark Mode Toggle
If there's time, we'll add a Dark Mode to the GST Calculator.
Materials:
Lab Time
- JS Activity: Form fields and DOM output
- Bonus Activity: Ratio to Percentage utility function
- Dark Mode Toggle upgrades: in-class code. Try the following upgrades to the dark mode toggle:
- Add a transition to the colour change that matches the timing of the slider;
- Add more colours to the form that also toggle;
- Add a dynamic label that changes from "Enable Dark Mode!" to "Dark Mode Enabled!" to match the current state of the switch.