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

Build an FAQ Toggle

Real websites often hide extra information until someone asks for it. You already know click events. Now reuse classList.toggle() to show and hide an FAQ answer.

01
Your mission

Make the FAQ button show the answer on the first click and hide it again on the next click.

  • Inside toggleAnswer(), toggle the hidden class on answer.
  • Keep the existing click listener.
Check FAQ Run project
Mission demoBuild an FAQ Toggle

Finished result only — the answer code stays hidden.