TouchEvent altKey Property

❮ DOM Events ❮ TouchEvent

Example

Find out whether or not the "ALT" key was pressed when you touch the screen:

if (event.altKey) {
  alert("The ALT key was pressed!");
} else {
  alert("The ALT key was NOT pressed!");
}
Try it Yourself »

Description

The altKey property returns a Boolean value that indicates whether or not the "ALT" key was pressed when a touch event was triggered.

Note: Many touch devices do not have an "ALT" key, and will therefore always return false.

Note: This property is read-only.


Browser Support

Property
altKey 22 yes 52 Not supported Not supported

Syntax

event.altKey

Technical Details

Return Value: A Boolean, indicating whether the "ALT" key was pressed when the touch event occurred.

Possible values:

  • true - The alt key was pressed
  • false - The alt key was not pressed

Related Pages

HTML DOM reference: MouseEvent altKey Property

HTML DOM reference: TouchEvent ctrlKey Property

HTML DOM reference: TouchEvent metaKey Property

HTML DOM reference: TouchEvent shiftKey Property


❮ DOM Events ❮ TouchEvent

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.