Get the accesskey of a link:
var x = document.getElementById("myAnchor").accessKey;
Click the button to get the accesskey of the link.
<!DOCTYPE html> <html> <body> <a id="myLink" accesskey="w" href="https://www.java2s.com/">Examples</a> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w . j a v a 2 s .co m*/ var x = document.getElementById("myLink").accessKey; document.getElementById("demo").innerHTML = x; } </script> </body> </html>