Search.../

altKey

Indicates if the Option key on a Mac or Alt key on a PC was pressed.

Type:

booleanRead Only

Was this helpful?

Gets the keyboard event's altKey property when the altKey is pressed

Copy Code
1$w("#myElement").onKeyPress( (event) => {
2 let alt = event.altKey; // true
3} );
Gets all of the keyboard event's properties

This example gets the properties of a keyboard event fired when the Shift and a keys are pressed.

Copy Code
1$w("#myElement").onKeyPress( (event) => {
2 let key = event.key; // "A"
3 let shift = event.shiftKey; // true
4 let meta = event.metaKey; // false
5 let alt = event.altKey; // false
6 let ctrl = event.ctrlKey; // false
7 let value = event.target.value; // string value of text inside "#myElement" before the last KeyPress event
8} );
9