JSFiddle - React, Tailwind, and code Playground

by winstonchang

HTML

<div id="target" style="width:300px; height:300px; background-color:#ddd">
Open the JS console and then click here.
</div>

JavaScript

const t = document.getElementById('target');
t.addEventListener('mousedown', e => {
  console.log("current e.offsetX: " + e.offsetX);
  console.log(e)

	setTimeout(() => {
     console.log("delayed e.offsetX: " + e.offsetX);
  }, 0);
})