JSFiddle - React, Tailwind, and code Playground

HTML

<a href="404.html" style="display:block;height:100px;width:350px;background-color:red;">&nbsp</a>
X:<span id='mouseX'></span>
Y:<span id='mouseY'></span>

JavaScript

var initialPos = 0;

$('a').mousedown(function(e){
    updatePos(e);
    console.log('down');
    initialPos = e.pageX;
});
$('a').mousemove(function(e){
    console.log('move');
    updatePos(e);
});
    
function updatePos(e) {
    $('#mouseX').html(e.pageX);
    $('#mouseY').html(e.pageY);
}