JSFiddle - React, Tailwind, and code Playground
HTML
<div id="target"></div>
CSS
#target{
margin-left:100px;
margin-top:200px;
width:100px;
height:100px;
background-color:#c66;
}
JavaScript
$('#target').mousemove(function(e){
var $thispos = $(this).offset();
var inImage = {'x':e.pageX - $thispos.left , 'y':e.pageY - $thispos.top};
$(this).html(inImage.x+ ', ' + inImage.y) ;
});