JSFiddle - React, Tailwind, and code Playground
by scruffles
HTML
<div id="parent">
<div id="child">
</div>
</div>
CSS
#parent {
background: red;
height: 40px;
width: 40px;
}
#child {
background: green;
height: 20px;
width: 20px;
}
JavaScript
$('body').on('click', '#parent', function(e) {
$('#parent').css({'background':'blue'});
});
$('body').on('click', '#child', function(e) {
$('#child').css({'background':'blue'});
e.stopPropagation();
});