JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<title>Click Test</title>
<body>
<canvas id="game"></canvas>
<div class="X">
asd asd as das da das dasd
</div>
CSS
#game {
border:1px solid #000;
height:300px;
width:300px;
}
JavaScript
$("#game").keydown(function(event){
alert(event.keyCode);
});
$("#game").click(function(e){
var x = e.pageX - $(this).offset().left;
var y = e.pageY - $(this).offset().top;
console.log(x+" "+y);
});