JSFiddle - React, Tailwind, and code Playground
HTML
<div class="toggler">
<div class="toggler1">This is the title 1</div
<div class="toggler2">This is the title 2 </div
<div> This is the content to be toggled </div>
</div>
CSS
div.toggler { background:lightblue; cursor:pointer; }
div.toggler div { display:none; }
div.toggler div { display:none; }
JavaScript
$(function() {
$('.toggler').click(function() {
$(this).find('div').slideToggle();
});
});