W3cubDocs

/DOM

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

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

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 47 (Yes)
"Accel" support No support ?
Feature Android Android Webview Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support No support 47 (Yes) 47
"Accel" support No support 47 ? 47

See also

© 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