JSFiddle - React, Tailwind, and code Playground

by Paulpro

HTML

<body>
    <div>
        <div class="ShowThis" src="http://google.com">
            Show This
        </div>
    </div>
    <div>
        Hide This
    </div>
</body>

JavaScript

var x = document.getElementsByTagName('*');
for(var i = 0; i < x.length; i++){
    x[i].style.display = 'none';
    if((' '+x[i].className+' ').indexOf(' ShowThis ') >= 0){
        var y = x[i];
        while(y){
            if(y.nodeType === 1){
                console.log(y.style.cssText);    // Outputs: "display: none;"
                console.log(y.style.display);   // Outputs: "none"
                y.style.display = 'block';
                console.log(y.style.display);    // Outputs: "block"
                console.log(y.style.cssText);    // Outputs: "display: block;"

                // Outputs the elements HTML (Chrome Console), but the style attribute isn't changed
                // EX. <div style="display: none;">...</div>
                console.log(y);
            }
            y = y.parentNode;
        }
    }
}