MouseEvent getModifierState() Method in JavaScript
MouseEvent getModifierState() Method in JavaScript
The getModifierState() method returns true if the specified modifier key was pressed on mouse event, or activated else it will return false.
Modifier keys that are activated only when they are being pressed down:
- Alt
- AltGraph
- Control
- Meta
- Shift
Modifier keys that are activated when they are clicked, and deactivated when they are clicked again:
- CapsLock
- NumLock
- ScrollLock
Syntax:-
Its syntax is:- event.getModifierState(modifierKey)
Return:-
Its return is:- true if specified modifier key is activated else false
Further Explanation:-
Parameter | Description |
---|---|
modifierKey | The key is to check if is activated or not. Some values are Alt, AltGraph, CapsLock, Control, Meta, NumLock, ScrollLock, Shift. |