THE WORLD'S LARGEST WEB DEVELOPER SITE

TouchEvent metaKey Property

❮ DOM Events ❮ TouchEvent

Example

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

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

Definition and Usage

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

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

On Mac keyboards, the META key is represented by the the "Command/Cmd" ("⌘") key.

Note: This property is read-only.


Browser Support

Property
metaKey 22 yes 52 Not supported Not supported

Syntax

event.metaKey

Technical Details

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

Possible values:

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

Related Pages

HTML DOM reference: MouseEvent metaKey Property

HTML DOM reference: TouchEvent altKey Property

HTML DOM reference: TouchEvent ctrlKey Property

HTML DOM reference: TouchEvent shiftKey Property


❮ DOM Events ❮ TouchEvent