3.08 · Lab
Events
Everything you've written so far ran the instant the page loaded. This one waits for a person — which means reading the value inside the listener, not before it.
Exercise
Wire the greeting button
Checks itself — try as often as you likeWire up the button on this page:
- Select
#greet-buttonand add a"click"event listener to it. - Inside the listener, read the current value of
#name-input, and set#greeting'stextContentto"Hello, " + that value + "!".