MouseEvent altKey Property
Definition and Usage
The altKey property returns a boolean value indicating whether the "ALT" key was pressed when the mouse event was triggered.
Note:On some Mac keyboards, the "ALT" key is displayed as "Option" or "Opt".
Note:This property is read-only.
Example
Determine if the "ALT" key was pressed when the mouse button was clicked:
if (event.altKey) { alert("The ALT key was pressed!"); } alert("The ALT key was NOT pressed!"); }
Syntax
event.altKey
Technical Details
Return value: |
A boolean value indicating whether the "ALT" key was pressed when the mouse event occurred. Possible values:
|
---|---|
DOM Version: | DOM Level 2 Events |
Browser Support
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
altKey | Support | Support | Support | Support | Support |
Related Pages
HTML DOM Reference Manual:MouseEvent ctrlKey Property
HTML DOM Reference Manual:MouseEvent metaKey Property
HTML DOM Reference Manual:MouseEvent shiftKey Property