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 use of js in project

Ayoub1Dev 195

@Ayoub1dev

Desktop design screenshot for the FAQ accordion card coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Any feedback on how to improve the js to make an accordion and also if there are other ways to make it.

My aim in this project was to practice my CSS andHTML but most importantly learn JS. I dont care how small or big my design is as that is an easy fix and its the job of designers,, so long as i got no issues(0 yaaay!!) Im pretty happy.

Thanks in advance for any feedback :}

Community feedback

Nic 595

@nicm42

Posted

This all looks great.

There are different ways of doing loops, but there's nothing wrong with the for loop. And not all the others will work with querySelectorAll, because JS is fun like that. MDN's page about querySelectorAll gives an example of forEach (which is a loop but doesn't look like it) so if you wanted you could go down a rabbit hole looking that up and trying to understand it.

There's a couple of other ways to make an accordion. One is to make each of them a checkbox, use CSS to hide the checkbox, and use JS to show the answers if the checkbox is checked. There are also the HTML tags details and summary, which will make an accordion without JS (but that's less useful if you want to practise your JS!)

0

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