JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" class="titleTrigger">slide it</input>
<div id="mydiv">
<h2 class="closeIt">close it</h2>
inside div
</div>
CSS
#mydiv{
top: 10;
left: 10;
width: 100px;
height: 100px;
background: blue;
display: none;
}
JavaScript
$("input.titleTrigger").click(function(e){
e.preventDefault();
//$(this).toggleClass("active").next().slideToggle("slow");
$("#mydiv").slideToggle("fast");
return false;
});
//CLOSE LINK
$(".closeIt").click(function(e){
e.preventDefault();
$(this).parent().slideUp("fast");
$(this).closest(".toggleContent").removeClass("active");
$(this).closest("h2.titleTrigger").removeClass("active");
});