Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

First solution of faq accordion challenge

tAndreii 40

@tAndreii

Desktop design screenshot for the FAQ accordion coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


This solution is only the first try, so it expands only the first answer and doesn't have a background-pattern. With the help of solutions on the site I'll figure out how to improve my solution and I'll upload it

Community feedback

@Serdarq1

Posted

Hi, I checked your script and the error happens because of usage of the querySelector. querySelector selects only the first child of multiple tags. There are multiple things you can do to improve your solution. Firstly, you can use querySelectorAll and then use forEach to loop every single item however if you are new to javascript I would not recommend it. Secondly, instead of using onClick on html page you can create event listener(questionContainer.addEventListener("click", () => {})) and you can loop every single item with forEach or you can name every container's class something different and add event listener to all. If you get stuck at somewhere you can ask again. Hope you find this helpful

Marked as helpful

0

tAndreii 40

@tAndreii

Posted

Hi, thank you for explanation, it's very helpful!!!

0
Daniel 🛸 44,230

@danielmrz-dev

Posted

Hello @tAndreii!

Your project looks really good!

You're missing the background, though.

  • Reminder: You can use both background-color and background-image together on the body. They will not cancel each other.

I hope it helps!

Other than that, great job!

1

tAndreii 40

@tAndreii

Posted

Hey, @danielmrz-dev!

Thank you for reply and tip about the background.

I appreciate it!

1

Please log in to post a comment

Log in with GitHub
Discord logo

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