Skip to content

Hide DIV if another DIV is active or visible with css/js

Trying to hide DIV if another DIV is active or visible with css/js.
Basically if an item is out of stock I would like to hide my custom div.

<script type="text/javascript">
require(['jquery'], function(jquery) {
    jquery(document).ready(function(){
        if(document.getElementByClass("stock.unavailable").style.visibility == "visible") {
    document.getElementByClass("left-stock").style.visibility = "hidden";
}
      
});
});
</script>