JavaScriptHTML + CSS + JavaScript
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
Mission 01 12 min
Reward+120 XP

Make the Button Run Code

An event is something that happens in the page. A click is one event.

button.addEventListener("click", doSomething);

The function name is passed without () because the browser should call it later, when the click happens.

Learn more

01
Your mission

Make the POWER UP button change the message when clicked.

  • Select #power-button into const powerButton.
  • Select #power-text into const powerText.
  • Create a function named showPower that changes the text to Power button clicked!.
  • Attach showPower to the button's click event with addEventListener.
Check my work Run project
Mission demoMake the Button Run Code

Finished result only — the answer code stays hidden.