Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Accordion responsive menu using javascript

Federico Salerno•210
@Federico-Salerno
A solution to the FAQ accordion card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I created the accordion menu by adding and removing the 'active' class using classList methods like classList.remove or classList.add. Also use classList.toggle to make the 'active' class dynamic. This accordion menu can be made directly from HTML using the <details>and <summary> tags that allow the text within <summary> to be displayed:

details>
           <summary>How many team members can I invite?</summary>
           <p>You can invite up to 2 additional users on the Free plan. There is no 
                        limit on team members for the Premium plan.</p>
 </details>
Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Federico Salerno's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License