--- title: MouseEvent.getModifierState() slug: Web/API/MouseEvent/getModifierState translation_of: Web/API/MouseEvent/getModifierState ---
{{APIRef("DOM Events")}}
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 {{domxref("KeyboardEvent.getModifierState","KeyboardEvent.getModifierState()")}} for details.
var active = event.getModifierState(keyArg);
A {{jsxref("Boolean")}}
keyArg
"Accel"
. This is case-sensitive.Specification | Status | Comment |
---|---|---|
{{SpecName('DOM3 Events', '#widl-MouseEvent-getModifierState', 'getModifierState()')}} | {{Spec2('DOM3 Events')}} | Initial definition. |
{{Compat("api.MouseEvent.getModifierState")}}