MouseEvent clientY Property

Example

The coordinates of the mouse pointer when clicked:

let x = event.clientX;  // Horizontal
let y = event.clientY;  // Vertical
Try it Yourself »

More examples below.


Description

The clientY property returns the vertical client coordinate of the mouse pointer when a mouse event occurs.

The clientY property is read-only.

The client area is the current window.


Coordinate Properties

PropertyRelative to
The screenX PropertyThe Screen area
The screenY PropertyThe Screen area
The clientX PropertyThe Window area
The clientY PropertyThe Window area
The pageX PropertyThe Page (Document)
The pageY PropertyThe Page (Document)
The offsetX PropertyThe target Element
The offsetY PropertyThe target Element

See Also:

The Mouse Event Object



Syntax

event.clientY

Technical Details

Return Value: A Number
The vertical window pixel coordinate of the mouse pointer
DOM Version: DOM Level 2 Mouse Events

More Examples

Example

The coordinates of the mouse pointer while the mousepointer moves:

let x = event.clientX;
let y = event.clientY; 
Try it Yourself »

Example

The differences between clientX and clientY and screenX and screenY:

let cX = event.clientX;
let cY = event.clientY;
let sX = event.screenX;
let sY = event.screenY;
Try it Yourself »

Browser Support

event.clientY is a DOM Level 2 (2001) feature.

It is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 9-11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.