JSFiddle - React, Tailwind, and code Playground

by wayne6172

HTML

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<div id="target">
</div>

CSS

#target {
    position: absolute;
    left: 50vw;
    top: 50vh;
    width: 30vw;
    height: 30vh;
    border: 3px solid red;
}

JavaScript

$('#target').click((e) => {
	console.log(e.pageX - e.target.offsetLeft);
	console.log(e.pageY - e.target.offsetTop);
})