

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM accessKey Property
The HTML DOM accessKey property is used to set the accessKey attribute of an element. However, the accesskey attribute in HTML is used to set a shortcut key to activate or focus on an element.
Following is the syntax to set the accessKey property −
HTMLElementObject.accessKey = char
Above, char is the shortcut key.
Following is the syntax to return the accessKey property −
HTMLElementObject.accessKey
On Windows, set the access key for different browsers −
Web Browser | Windows OS |
---|---|
Safari | [Alt] + accesskey |
Chrome | [Alt] + accesskey |
Firefox | Alt] [Shift] + accesskey |
Let us now see an example to implement the accesskey property on Chrome web browser on Windows −
Example
<!DOCTYPE html> <html> <body> <a id="myid" accesskey="g" href="https://www.google.com/">Google</a> <p>Get the accessKey</p> <button onclick="display()">Click and display the accesskey</button> <p id="pid"></p> <script> function display() { var a = document.getElementById("myid").accessKey; document.getElementById("pid").innerHTML = a; } </script> </body> </html>
Output
Click on the above button to display the accessKey −
- Related Questions & Answers
- HTML accesskey Attribute
- HTML DOM activeElement Property
- HTML DOM paddingLeft Property
- HTML DOM id Property
- HTML DOM innerHTML Property
- HTML DOM innerText Property
- HTML DOM readyState Property
- HTML DOM ownerDocument Property
- HTML DOM scrollHeight Property
- HTML DOM scrollWidth Property
- HTML DOM scrollLeft Property
- HTML DOM scrollTop Property
- HTML DOM parentElement Property
- HTML DOM parentNode Property
- HTML DOM previousSibling Property
Advertisements