Search w3schools.com:

SHARE THIS PAGE

metaKey Event Attribute

Event Object Reference Event Object

Definition and Usage

The metaKey event attribute returns a Boolean value that indicates whether or not the "meta" key was pressed when an event was triggered.

Syntax

event.metaKey


Example

Example

The following example alerts whether or not the "meta" key was pressed when a mouse button was clicked:

<html>
<head>
<script>
function isKeyPressed(event)
{
if (event.metaKey==1)
{
alert("The meta key was pressed!")
}
else
{
alert("The meta key was NOT pressed!")
}
}
</script>
</head>

<body onmousedown="isKeyPressed(event)">
<p>Click somewhere in the document.
An alert box will tell you if you
pressed the meta key or not.</p>

</body>
</html>

Try it yourself »


Event Object Reference Event Object

W3Schools Certification

W3Schools' Online Certification

The perfect solution for professionals who need to balance work, family, and career building.

More than 10 000 certificates already issued!

Get Your Certificate »

The HTML Certificate documents your knowledge of HTML.

The HTML5 Certificate documents your knowledge of advanced HTML5.

The CSS Certificate documents your knowledge of advanced CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The jQuery Certificate documents your knowledge of jQuery.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]