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.
var active = event.getModifierState(keyArg);
A Boolean
keyArg
KeyboardEvent.key
values which represent modifier keys or "Accel"
. This is case-sensitive.Specification | Status | Comment |
---|---|---|
Document Object Model (DOM) Level 3 Events Specification The definition of 'getModifierState()' in that specification. | Obsolete | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 47 | Yes | ? | ? | ? | ? |
"Accel" parameter
|
No | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 47 | 47 | Yes | ? | ? | ? | ? |
"Accel" parameter
|
No | No | ? | ? | ? | ? | ? |
MouseEvent
this method belongs to.KeyboardEvent.getModifierState
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/getModifierState