JavaScript element.accessKey Property

You are Here:

JavaScript element.accessKey Property

The element.accessKey property gets or sets the accesskey attribute of an element.

Get the accessKey


HTML Online Editor
<!DOCTYPE html> <html> <body> <a href="/jquery" accesskey="j">Learn jQuery</a> <button onclick="myFunction()">Click Me</button> <p id="point"></p> <script> var x = document.getElementById("point"); var elem = document.getElementsByTagName("a")[0]; function myFunction(){ x.innerHTML = elem.accessKey; } </script> </body> </html>

Accessing shortcut key

google chrome[Alt] + accesskey[Ctrl] [Alt] + accesskey[Alt] + accesskey
safari[Alt] + accesskey[Ctrl] [Alt] + accesskeyN/A
firefox[Alt] [Shift] + accesskey[Ctrl] [Alt] + accesskey[Alt] [Shift] + accesskey
internet Explorer[Alt] + accesskeyN/AN/A
operaOpera 15+ : [Alt] + accesskey
Opera 12: [Shift] [Esc] + accesskey



Return Values

StringReturns the accesskey value of the given element.

Set the accessKey


HTML Online Editor
<!DOCTYPE html> <html> <body> <a href="/jquery">Learn jQuery</a> <script> document.getElementsByTagName("a")[0].accessKey = "j"; </script> </body> </html>


Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author