JavaScriptHTML + CSS + JavaScript
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
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 thehiddenclass onanswer. - Keep the existing click listener.
Check FAQ Run project