The KeyboardEvent altKey property in HTML DOM is a read-only property and used to return the boolean value which indicates the alt key is pressed or not. It returns True if alt key is pressed otherwise return false.
Below program illustrates the KeyboardEvent altkey property in HTML:
Example: This example check whether the “ALT” key is pressed or not.
Before Press the Key:
After Press the key:
Supported Browsers: The browser supported by KeyboardEvent altKey property are listed below:
- Internet Explorer
- Google Chrome
- Apple Safari