Detect current mouse coordinates using jquery

If you need to detect the current mouse coordinates in the web browser in use. To do this, you can write the following piece of code:

$(document).ready(function() {
        $().mousemove(function(e) {
            $('#MouseCoordinates').html("X Axis Position = " + e.pageX + " and Y Axis Position = " + e.pageY);
<div id="MouseCoordinates"></div>

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.