JSFiddle - React, Tailwind, and code Playground

by stevea

HTML

<div class="beige"></div>
<div class="orange"></div>

CSS

div.beige{
    width:100px;
    height:100px;
    background-color:beige;
}
div.orange{
    width:100px;
    height:100px;
    background-color:orange;
}

JavaScript

$(function() {
             
    $(document).click(function(e) {
   
        if ($(e.target).hasClass('beige')){
            console.log('beige box clicked ');
        }
        if ($(e.target).hasClass('orange')){
            console.log('orange box clicked ');
        }
    });
    
    });