JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" onclick="toggler('myContent');">this is a test</a>
<div id="myContent" class='hidden'>
<div>this is a test #1 </div>
</div>
<br />
<a href="#" onclick="javascript:toggler('myContentt');">
<span>this is a text</span>
</a>
<div id="myContentt" class='hidden'>
this is a test #2
</div>
CSS
.hidden {
display:none;
}
JavaScript
function toggler(divId) {
$("#" + divId).toggle();
}