MouseEvent ctrlKey Property
Example
Was the "CTRL" key pressed when the mouse button was clicked:
if (event.ctrlKey) {
text = "The CTRL key was pressed!";
} else {
text = "The CTRL key was NOT pressed!";
}
Try it Yourself »
Description
The ctrlKey
property returns true
if
the CTRL key is pressed when a mouse event occurs.
Otherwise it returns false
.
The ctrlKey
property is read-only.
Syntax
event.ctrlKey
Technical Details
Return Value: |
A Boolean. Returns true if the CTRL key was pressed when a mouse event occurs.Otherwise it returns false . |
---|---|
DOM Version: | DOM Level 2 Events. |
Browser Support
event.ctrlKey
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.