JSFiddle - React, Tailwind, and code Playground
HTML
<button id="addButton">Show button box</button>
<div id="buttons">
<!-- something here -->
</div>
CSS
#buttons {
display: none;
background: powderblue;
width: 200px;
height: 100px;
}
JavaScript
let addButton = document.getElementById('addButton');
addButton.addEventListener('click', function() {
let buttonBox = document.getElementById('buttons');
console.log(buttonBox.style.display);
if (buttonBox.style.display == "none") {
buttonBox.style.display = "block";
console.log("Changed to: block");
} else {
buttonBox.style.display = "none";
console.log("Changed to: none");
}
}, false);