JSFiddle - React, Tailwind, and code Playground

by Valeriy

HTML

<button onclick="myFunction()">Try it</button>

<div id="myDIV">
This is my DIV element.
</div>

CSS

#myDIV {
    width: 100%;
    padding: 50px 0;
    text-align: center;
    background-color: lightblue;
    margin-top: 20px;
}

JavaScript

function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}