MouseEvent.getModifierState()
The MouseEvent.getModifierState()
method returns the current state of the specified modifier key: true
if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false
.
See the document of KeyboardEvent.getModifierState()
for details.
Syntax
var active = event.getModifierState(keyArg);
Returns
A boolean value
Parameters
keyArg
-
A modifier key value. The value must be one of the
KeyboardEvent.key
values which represent modifier keys or"Accel"
. This is case-sensitive.
Specifications
Specification |
---|
UI Events # dom-mouseevent-getmodifierstate |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getModifierState |
47 |
12 |
15 |
9 |
34 |
12.1 |
47 |
47 |
15 |
34 |
12.2 |
5.0 |
accel_support |
No |
No |
? |
? |
? |
? |
No |
No |
? |
? |
? |
No |
See also
- The
MouseEvent
this method belongs to. KeyboardEvent.getModifierState
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/getModifierState