jQuery Event - pageX Property

Example

Display the position of the mouse pointer:

$(document).mousemove(function(e){
  $("span").text("X: " + e.pageX + ", Y: " + e.pageY);
});

Try It Yourself

Definition and Usage

The pageX() property is the position of the mouse pointer, relative to the left edge of the document.

Syntax

event.pageX
Parameter Description
event Required. Specifies the event to be used. This event Parameters come from the event binding function.