getModifierState
Summary
Queries the state of the specified modifier key.
Method of dom/KeyboardEventdom/KeyboardEvent
Syntax
var modifierState = event.getModifierState(modifierKeyName);
Parameters
modifierKeyName
- Data-type
- String
One of the following values -
- Alt - The left or right Alt key.
- AltGraph - The Ctrl and Alt keys.
- CapsLock - The Caps Lock toggle.
- Control - The left or right Ctrl key.
- Meta - The Meta/Control key.
- NumLock - The Num Lock toggle.
- ScrollLock - The Scroll Lock toggle.
- Shift - The left or right Shift key.
- Fn
- OS
- SymbolLock
Other implementation specific options may be supported. For example -
- Win (on Microsoft Windows) - The left or right Windows logo key.
- Scroll - The Scroll Lock toggle.
Return Value
Returns an object of type BooleanBoolean
Whether the modifier key is active.
Notes
Some keyboard configurations contain a left and right modifier key. To determine whether the left or right key is pressed, use the location property.
Related specifications
- DOM Level 3 Events
- Working Draft
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]