If you want to show content when class exit in this page then you can use this code .It will give alert ok when class attribute exit in this page , you can change also class to id if you want.

<body>
<div class="home-container">
    <div class="home">

        Content

    </div>
    <span style="cursor: pointer; background: #0f192a;color: #00BD9B" onclick="test()">Click</span>
</div>
</body>

then this is javascript code which give alert if class attribute exit in this page

function test() {
        if (document.querySelector('.home') !== null) {
            alert('ok');
        } else {
            alert('not');
        }
    }

In this code home attribute exit so it will give alert ok.
If you find any problem then please inform me.

Comment