Web HTMLElement API | Element accessKeyLabel property
In Web API there are elements which have accesskey attribute. To fetch this accesskey attribute we use HTMLElement.accessKeyLabel property, which returns a String assigned to the accesskey attribute of the element.
Syntax:
label = element.accessKeyLabel
Note: If the accesskey attribute value is not provided then it returns an empty String.
Example: Height attribute set to 300
<!DOCTYPE html> <html> <head> <style> a:focus { background-color: magenta; } </style> <script type="text/javascript"> function getaccesskey() { var label = document.getElementById('btn'); document.getElementById( 'access').innerHTML = label.accessKeyLabel; } </script> </head> <body> <center> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>HTML Element accessKeyLabel property</h2> <button accesskey="g" onclick="getaccesskey();" id="btn"> Get accessKeyLabel </button> <p id='access'></p> </center> </body> </html> |
Output:
Click the button:

When the button is clicked:

Supported Browsers:
- Firefox 8
Recommended Posts:
- Web HTMLCanvasElement API | Canvas Element width property
- How to remove parent element except its child element using jQuery ?
- jQuery | Move an element into another element
- CSS | element+element Selector
- CSS | element~element Selector
- CSS | element,element Selector
- CSS | element > element Selector
- CSS | element element Selector
- CSS | transition-property Property
- CSS | element Selector
- Display div element on hovering over <a> tag using CSS
- How to set the value of a select box element using JavaScript?
- How to change the element id using jQuery ?
- How to add a box-shadow on one side of an element using CSS?
- How to add space (" ") after an element using :after selector in CSS ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.



