JSFiddle - React, Tailwind, and code Playground
by IllusionMH
HTML
<div>Will be red after click</div>
<div>Will be white after click</div>
CSS
div {
width: 300px;
height: 300px;
border: 1px solid black;
}
JavaScript
$(document).click(function() {
//selects only first div
var el = document.querySelector('div');
//you can use more specific selector
$(':hover').each( function(i) {
if( el == this) {
$(el).css('background-color', 'red');
}
});
});