I have a basic canvas
<body>
<canvas id="Canvas" width="500" height="704" style="border:1px solid #000000;"> </canvas>
</body>
and I'm trying to get the coordinates of onClick event inside of the canvas. I found a good post about doing it with event.offsetX (referenced post) however, that code only works when the js script is in the same file. What I'd like to do is handle the coordinates in a function that's in a separate "app.js" file. I tried referencing the function that I'd like to handle the data (let's call it "click()" ) in the onClick property of the canvas. I'm not sure if that's the wrong aproach or I missed something but it didn't work. I'm just strating out with javascript. Ideally I'd like to have no javascript in the html file at all but I'll be happy with whatever works.
Thanks