Skip to main content
CodeOath
← All challenges

Challenge

Accordion / FAQ Toggle

Easy
  • javascript
  • dom
  • accessibility

Build an FAQ list where clicking a question shows its answer and clicking it again hides it.

Notes:

  • Whether opening one question closes the others is up to you. Either works, as long as the list behaves the same way every time.

Check your work against

  • At least 3 question/answer pairs
  • Clicking a question toggles its answer open/closed
  • Some visual indicator (an arrow/chevron/plus-minus) shows open vs. closed state
  • Works with more than one click in a row without getting stuck

No automatic grading

Check your work against the list above, then compare it with the solution preview.

Tab indents. Press Esc, then Tab to leave the editor.

Live preview

Starter loaded. The preview updates as you type.