Wednesday, July 3, 2024
HomeLanguagesJavascriptWeb API ButtonElement.accessKey Property

Web API ButtonElement.accessKey Property

The HTML ButtonElement.accessKey property is used to return a DOMString which is a single character representing the accessKey in the given button.

Syntax:

ButtonElement.accessKey

Return Value: This property returns a DOMString which is a single character representing the accessKey to the given button.

Example 1:

HTML




<h1 style="color:green">neveropen</h1>
  
<h2>HTMLButtonElement.accessKey property</h2>
  
<button accessKey='g' onclick="gfg()">
    Click
</button>
<p id="gfg"></p>
<script type="text/javascript">
    function gfg() {
        var a = document.getElementsByTagName("button");
        document.getElementById("gfg").innerHTML = 'accessKey is : '+a[0].accessKey;
    }
</script>


Output:

 

Example 2:

HTML




<h1 style="color:green">neveropen</h1>
  
<h2>HTMLButtonElement.accessKey property</h2>
  
<button accessKey='k' onclick="gfg()">
    Click
</button>
  
<script>
    function gfg() {
        var a = document.getElementsByTagName("button");
        document.write('accessKey is : ', a[0].accessKey);
    }
</script>


Output:

Web API ButtonElement.accessKey Property

Web API ButtonElement.accessKey Property

Supported Browsers:

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

Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen 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!

Nokonwaba Nkukhwana
Experience as a skilled Java developer and proven expertise in using tools and technical developments to drive improvements throughout a entire software development life cycle. I have extensive industry and full life cycle experience in a java based environment, along with exceptional analytical, design and problem solving capabilities combined with excellent communication skills and ability to work alongside teams to define and refine new functionality. Currently working in springboot projects(microservices). Considering the fact that change is good, I am always keen to new challenges and growth to sharpen my skills.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments