DEV Community

Discussion on: How to build an accordion with JavaScript

Collapse
 
steinbring profile image
Joe Steinbring

Very good post but I would suggest looking at doing something like ...

<details>
  <summary>Accordion Title</summary>
  <p>Accordion Body</p>
</details>
Enter fullscreen mode Exit fullscreen mode

... in your markup. Since that gets you an accordion by itself, all you need to do is add some CSS to make it look how you want it to look.