jQuery event.pageX Property

jQuery event.pageX property is a read-only and returns the X (horizontal) position (in pixels) of mouse pointer, to the left edge of the document.

Syntax

event.pageX
Parameter Type Description
event Event Required. The event parameter comes from event bind method

Example

This example returns the mouse pointer position.

<!DOCTYPE html>
<html>
<head>
  <title>jQuery event.pageX and event.pageY property</title>
  <script src="jquery-latest.min.js"></script>
  <script>
    $(document).ready(function(){
      $(document).mousemove(function(event){ 
        $("span").text("pageX: " + event.pageX + ", pageY:  " + event.pageY); 
      });
    });
  </script>
</head>
<body>
  <p>Mouse pointer position</p>
  <span></span>
</body> 
</html>

Run it...   »