JSFiddle - React, Tailwind, and code Playground
by dru_zod
HTML
<div id="red" class="red">
<div id="blue" class="blue">
</div>
</div>
CSS
.red{
display: block;
background-color: red;
width: 200px;
height: 200px;
}
.blue {
display: block;
background-color: blue;
width: 100px;
height: 100px;
}
JavaScript
var red = document.getElementById('red'),
blue = document.getElementById('blue');
red.addEventListener('click', function (e) {
e.stopPropagation();
alert('red');
});
blue.addEventListener('click', function (e) {
e.stopPropagation();
alert('blue');
});