Home >>jQuery Tutorial >jQuery event.pageX() Property

jQuery event.pageX() Property

jQuery event.pageX() Property

jQuery event.pageX() property in jQuery is used to returns the position of the mouse pointer which is relative to the left edge of the document.

Syntax:
event.pageX

Parameter Values

Parameter Description
event It is a required parameter and is used to the event parameter comes from the event binding function
Here is an Example of jQuery event.pageX Property:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(document).mousemove(function(event){ 
$(".txt2").text("X: " + event.pageX + ", Y: " + event.pageY); 
});
});
</script>
</head>
<body>
<p class="txt1"> mouse pointer position is: <span class="txt2"></span></p>
</body>
</html>

Output:

mouse pointer position is: