JSFiddle - React, Tailwind, and code Playground
HTML
<div id='myDiv' onclick="divClicked(event)"></div>
CSS
#myDiv
{
background-size: contain;
position:absolute;
width:800px;
height:600px;
border: 1px;
border-style: solid;
background: url('http://s12.postimg.org/upm7g6c25/13_000123_7_AA_png.jpg') no-repeat center;
background-color: yellow;
}
JavaScript
function divClicked(e) {
alert("target is always '"+e.target.id+"'. How can I detect weather the yellow spot or the gun was clicked?");
}