I have a little div tag that when I click it (onClick event), it will run the printMousePos() function. This is the HTML tags:
onClick
printMousePos()
HTML
simple solution is this:
game.js:
document.addEventListener('click', printMousePos, true); function printMousePos(e){ cursorX = e.pageX; cursorY= e.pageY; $( "#test" ).text( "pageX: " + cursorX +",pageY: " + cursorY ); }