JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="myFunction()">Button</button>
<div class="content">
Content of element
</div>
CSS
.content {
width: 80%;
padding: 10%
text-align: center;
background-color: lightblue;
margin-top:20px;
}
JavaScript
window.myFunction = function () {
var x = document.getElementsByClassName('content');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}