JSFiddle - React, Tailwind, and code Playground

by steveukx

HTML

<div id="firstid" class="someclass">
</div>

<div class="secondclass">click me</div>

CSS

.someClass { width: 50px; height: 50px; background: red; }
.secondclass { cursor: pointer; }

JavaScript

$(document).ready(function() {
    $("div.secondclass").click(function () {
        firstclass=$('#firstid').attr('class');
        alert("the class of the 1st div is ="+firstclass);
    });
});