KeyboardEvent metaKey property
Definition and usage
The metaKey property returns a boolean value indicating whether the "META" key was pressed during the key mouse event.
Not all keyboards have a meta key. For Sun Microsystems keyboards and MIT and LISP machine keyboards, it is common. The meta key is marked as "META" or marked with a solid diamond symbol "◆".
On Mac keyboards, the META key is represented by the "Command/Cmd" ("⌘") key.
Note:This property is read-only.
Example
Determine if the "META" key was pressed when the keyboard key was pressed:
var x = document.getElementById("demo"); if (event.metaKey) { x.innerHTML = "The META key was pressed!"; } x.innerHTML = "The META key was NOT pressed!"; }
Syntax
event.metaKey
Technical details
Return value: |
A boolean value indicating whether the "META" key was pressed when the key event occurred. Possible values:
|
---|---|
DOM version: | DOM Level 2 Events |
Browser support
Egenskaber | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
metaKey | Support | Support | Support | Support | Support |
Relaterede sider
HTML DOM reference manual:KeyboardEvent altKey egenskab
HTML DOM reference manual:KeyboardEvent ctrlKey egenskab
HTML DOM reference manual:KeyboardEvent shiftKey egenskab