JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <div id="button">Click<div>
    <div id="box"></div>
</body>

CSS

#button {
    width: 40px;
    height: 20px;
    border: 1px solid;
}
#box {
    width: 50px;
    height: 50px;
    background-color: red;
    display: block;
}

JavaScript

document.getElementById('button').onclick = function() {
    var attr = document.getElementById('box').style.display;
    alert(attr);
}