JSFiddle - React, Tailwind, and code Playground

HTML

<div class="background"></div>
<div class="clicky"></div>

CSS

.background {
width: 100%;
height: 500px;
background: green;
display: block;
position: absolute;
}

.clicky {
width: 100px;
height: 100px;
background: red;
display: block;
position: absolute;
}

JavaScript

var clicks = 0;
$('.clicky').on('click', function()
    {
    clicks++;
    if(clicks >= 5)
        {
        $(this).add($('.background')).hide();
        }
});