Easy Tutorial
❮ Jsref Dowhile Prop Input Time Name ❯

metaKey Event Property


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


Example

Example

The following example shows whether the "meta" key is held down when the mouse button is clicked:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function isKeyPressed(event){
    if (event.metaKey==1){
        alert("Meta key is pressed!");
    }else{
        alert("Meta key is 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.</p>

</body>
</html>

❮ Jsref Dowhile Prop Input Time Name ❯