altKey Event AttributeEvent Object
Definition and Usage
The altKey event attribute returns a Boolean value that indicates whether or not the "ALT" key was pressed when an event was triggered.
The following example alerts whether or not the "ALT" key was pressed when a mouse button is clicked:
alert("The ALT key was pressed!")
alert("The ALT key was NOT pressed!")
<p>Click somewhere in the document.
An alert box will tell you if you
pressed the ALT key or not.</p>
Try it yourself »
Thank You For Helping Us!
Your message has been sent to W3Schools.