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

FAQ accordion using CSS Flexbox and Javascript

brenda127s•20
@brenda127s
A solution to the FAQ accordion challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello community! I am still learning javascript and the basics of it. I had trouble alternating between the plus and minus icons. Once I finally got it to work, you can still see the plus icon behind it. How would you typically switch between icons, making one or the other visible based on clicks?

I also had trouble expanding the paragraph element within javascript. I got it to work when the icons were clicked, then I got it to work when the questions were clicked but then it wouldn't work with the icons anymore. Is there a way to add two variables to the same forEach method? How would I be able to have two different variables perform the same function?

I appreciate any help/criticism!

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 brenda127s'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