JSFiddle - React, Tailwind, and code Playground

HTML

<div id="my">
    <div id="myy"></div>
</div>

CSS

#my {
 height: 50px;width:50px;
 background: green;    
}
#myy {
 height: 25px;width:25px;
 background: red;    
}

JavaScript

var elem = document.getElementById('my');
elem.onclick = function(){
  event = event || window.event;
  var target = event.target || event.srcElement;
  alert(target)   
}