d
Amit DhamuSoftware Engineer
 

Get Mouse Coordinates

1 minute read 00000 views
$(document).ready(function () {
  var xPos = 0,
    yPos = 0

  $(this).mousemove(function (e) {
    xPos = e.pageX
    yPos = e.pageY

    $('#coordinates').html('X: ' + xPos + ' | Y: ' + yPos)
  })
})
<div id="coordinates"></div>