JSFiddle - React, Tailwind, and code Playground

by Ehsan Sajjad

HTML

<button id="btnAddClass">Add Class</button>
<div id="box">A box for clicking.</div>
<span id="displayText" style="display: none">You clicked the box!</span>

CSS

#box {
    border: 2px solid #f00;
}

.boxClick
{
background:yellow;
}

JavaScript

$(document).on('click','.boxClick', function() {
    $('#displayText').show();
});

$('#btnAddClass').on('click', function() {
    $('#box').addClass('boxClick');
});