Skip to content

Detect Current Mouse Coordinates using JQuery

Here is the simple JQuery script snippet for detecting current mouse coordinates using JQuery function.

$(document).mousemove(function(e){
    console.log("X = " + e.pageX + " and Y  = " + e.pageY);
});

we can achieve above result with JavaScript , here is the snippet with JS.

window.onmousemove = function handleMouseMove(event) {
   console.log("X = " + event.clientX +  " and Y  = " +  event.clientY);
}
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments