JSFiddle - React, Tailwind, and code Playground

HTML

<div id="theDiv">This is a div!</div>
<button id="myButton">Click Me to Toggle the Div!</button>

CSS

div{width:300px;height:300px;background-color:red}
button{font-size:20px;padding:10px;}

JavaScript

// When the page is ready and loaded
$(function(){
    // On click of "myButton"
    $('#myButton').click(function(){
        // "slideToggle" the div
        // ie: If hidden show it, else hide it
        $('#theDiv').slideToggle();
    });
})