JSFiddle - React, Tailwind, and code Playground

HTML

Testing

<div id="container"></div>

<div id="coords"></div>

CSS

#container {
    width: 100px;
    height: 100px;
    background-color: red;
    position: absolute;
    top: 50px;
    left: 50px;
}

JavaScript

$("div#container").click( function(e) {
    var client_x = e.pageX - $(this).offset().left,
      client_y = e.pageY - $(this).offset().top;
    
    $("#coords").html (client_x + ',' + client_y)

});