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

Specification Status Comment
Document Object Model (DOM) Level 3 Events Specification
The definition of 'getModifierState()' in that specification.
Obsolete Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support47 Yes ? ? ? ?
"Accel" parameter No ? ? ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support4747 Yes ? ? ? ?
"Accel" parameter No No ? ? ? ? ?

See also

Document Tags and Contributors

Contributors to this page: fscholz, libbymc, jpmedley, teoli, Masayuki
Last updated by: fscholz,