HTML | DOM KeyboardEvent metaKey Property

The KeyboardEvent metaKey property in HTML DOM is a read-only property and is used to return a Boolean value which is used to check whether the META key is pressed or not. The KeyboardEvent metaKey property returns true if the META key is pressed, otherwise returns false.



Below program illustrates the KeyboardEvent metakey Property in HTML DOM:

Example: This example check whether the META key is pressed or not.





<!DOCTYPE html>
        HTML DOM KeyboardEvent metaKey Property
    <h2>KeyboardEvent metaKey Property</h2>
        Check whether the META key is
        pressed or not
    <input type="text" onkeydown="keyboard(event)">
    <p id="test"></p>
    <!-- script to ckeck meta key pressed or not -->
        function keyboard(event) {
            var a = document.getElementById("test");
            if (event.metaKey) {
                a.innerHTML = "The META key has been pressed!";
            else {
                a.innerHTML = "The META key has not been pressed!";


Before Press the key:

After Press the key:

Supported Web Browsers

  • Opera
  • Internet Explorer
  • Google Chrome
  • Firefox
  • Apple Safari


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.