jQuery mousemove() show mouse coordinate

Description

jQuery mousemove() show mouse coordinate

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/* w ww.  j a va2s  .c o m*/
<script>
$(document).ready(function(){
  $(document).mousemove(function(event){
    $("span").text(event.pageX + ", " + event.pageY);
  });
});
</script>
</head>
<body>

<p>Mouse is at coordinates: <span></span>.</p>

</body>
</html>



PreviousNext

Related