JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <h3><a href="#box1"> box 1</a></h3>
    <div class ="toggle" id="box1">
        box nummer 1
</div>
    <br /><br />
    <h3><a href="#box2"> box 2</a></h3>
<div class ="toggle" id="box2">
        box nummer 2
</div>  
</div>

CSS

div.toggle{display: none;}

JavaScript

$("a").click(function(){
   var myelement = $(this).attr("href")
    $(myelement).slideToggle("slow");
    //$(".toggle:visible").not(myelement).hide();
    //optionele lijn om de rest dicht te klappen
  });