Open In App
Related Articles

HTML | DOM KeyboardEvent metaKey Property

Improve Article
Save Article
Like Article

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 12.1
  • Internet Explorer 9
  • Google Chrome 1
  • Edge 12
  • Firefox 1.5
  • Apple Safari 1.2

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 06 Jul, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials