JSFiddle - React, Tailwind, and code Playground

by Ian Oxley

HTML

<html>
    <title>Click Test</title>
<body>
    <canvas id="game"></canvas>

CSS

#game {
    border:1px solid #000;
    height:300px;
    width:300px;
}

JavaScript

$(window).keydown(function(event){
    console.log(event);
});

$("#game").click(function(e){
    var x = e.pageX - $(this).offset().left;
    var y = e.pageY - $(this).offset().top;
    console.log(x+" "+y);
});