JSFiddle - React, Tailwind, and code Playground
by j08691
HTML
<div id="elem-0" onClick="updateSelectedElement(0);">
<img src="http://www.placehold.it/100x50" id="elem-1" onClick="updateSelectedElement(1);">
</div>
CSS
div {
height:100px;
background: #eee;
}
JavaScript
function updateSelectedElement(id) {
console.log(id)
if (event.stopPropagation) {
event.stopPropagation();
} else {
window.event.cancelBubble = true
}
}