jQuery Mouse Event Position Relative to the Document Using
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Find Coordinates of Mouse Pointer Relative to the Document</title> <style> html, body{ height:100%; }//from ww w . j av a 2s. co m </style> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script> $(document).ready(function() { $("body").mousemove(function(event){ var relPageCoords = "(" + event.pageX + "," + event.pageY + ")"; $(".mouse-cords").text(relPageCoords); }); }); </script> </head> <body> <p>Coordinates of mouse pointer with respect to the page: <strong class="mouse-cords"></strong></p> </body> </html>