YouTip LogoYouTip

Event Metakey

# metaKey Event Property [![Image 3: Event Object Reference Manual](#) Event Object](#) * * * ## Definition and Usage The metaKey event property returns a boolean value indicating whether the "meta" key was pressed and held down when the event occurred. ## Syntax event.metaKey * * * ## Example ## Example The following example alerts whether the "meta" key was held down when a mouse button was clicked: function isKeyPressed(event){ if (event.metaKey==1){ alert("meta key is pressed!"); }else{ alert("meta key is not pressed!"); } }

Click somewhere in the document. An alert box will tell you if you pressed the meta key.

[Try it Β»](#) * * Event Object](#)
← Event RelatedtargetEvent Ctrlkey β†’