KeyboardEvent location Property in JavaScript
KeyboardEvent location Property in JavaScript
The location property is a read-only property and it is used to return a number that indicates the location of a key on the keyboard or device. It is usually broken down into 4 constants. These are:-
- 0 => DOM_KEY_LOCATION_STANDARD i.e, the key was not pressed on right or left side of keyboard and not on numeric keypad.
- 1 => DOM_KEY_LOCATION_LEFT i.e, left key was pressed like left "CTRL" key or left "ALT" key.
- 2 => DOM_KEY_LOCATION_RIGHT i.e, right key was pressed like right "CTRL" key or right "CTRL" key.
- 3 => DOM_KEY_LOCATION_NUMPAD i.e, key was pressed on the numeric keypad.
Syntax:-
Its syntax is:- event.location
Return:-
Its return is:- number denoting the location of a key on keyboard or device