Skip to main content

Mouse Current Position - JS

Get the current position of the mouse using 'MouseEvent' clientX and clientY properties. Move the mouse on any position to see the values in demo below.

DEMO

JS

document.addEventListener('mousemove', (e) => {
console.log(`Mouse X: ${e.clientX}, Mouse Y: ${e.clientY}`);
});

Comments