Design comparison
SolutionDesign
Solution retrospective
What specific areas of your project would you like help with?
Making the javascript simpler
Community feedback
- @gilotinPosted 5 days ago
This is my solution. You can compare it to yours. I'm sure my code could be more robust, but I'm still learning too.
faqs.forEach((faq) => faq.addEventListener("click", () => { const buttonImg = faq.querySelector("img"); faq.classList.toggle("active"); if (buttonImg.className == "closed") { buttonImg.src = "./assets/images/icon-minus.svg"; buttonImg.className = "open"; } else { buttonImg.src = "./assets/images/icon-plus.svg"; buttonImg.className = "closed"; } }) );
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin 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