The jQuery event pageX and pageY provides the position of the mouse pointer, relative to the left edge pageX and/or right edge pageY of the document.

Syntax

event.pageX event.pageY

Basic Example

In the following jQuery example, the event.pageX and event.pageY will be used to display the X and Y position of the mouse cursor.

You can also get the pageX and pageY coordinates for a specific HTML element by making some simple changes to the jQuery code as follows.