JSFiddle - React, Tailwind, and code Playground

by David Buzatto

HTML

<div id="divOne">One</div>
<div id="divTwo" style="display: none;">Two</div>
<div id="divThree" class="hide">Three</div>

CSS

.hide {
    display: none;
}

JavaScript

alert( isVisible( "divOne" ) );
alert( isVisible( "divTwo" ) );
alert( isVisible( "divThree" ) );

function isVisible( elementId ) {
    var element = document.getElementById( elementId );
    return window.getComputedStyle( element, null ).display != "none";
}