Open In App

HTML accesskey Attribute

The accesskey attribute in HTML is the keyboard shortcut to activate/focus specific elements. The access key attribute is browser-dependent. It may vary from browser to browser.

Supported Tags: It supports all HTML elements. 



Syntax

<element accessKey = "single_character">

Shortcut to use accesskey

The table describes the shortcut to use accesskey.  

Browser Windows Mac Linux
Google Chrome Alt + single_character Command + Alt + single_character Alt + single_character
Mozilla Firefox Alt + Shift + single_character

Command + Alt + single_character (On Firefox 14 or newer)

Command + single_character (On Firefox 13 or older)

Alt + Shift + single_character
Internet Explorer Alt + single_character N/A N/A
Safari Alt + single_character Command + Alt + single_character N/A
Opera 15+ Alt + single_character Command + Alt + single_character Alt + single_character

Note:  

The behavior of the browser differs when dealing with more than one element having the same accesskey:



HTML accesskey Attribute Example

Example: In this example demonstrates the use of the accesskey attribute, which assigns the keyboard shortcut “g” to the link. Users can access the linked page by pressing the specified key combination.




<!DOCTYPE html>
<html>
    <head>
        <title>accesskey attribute</title>
    </head>
 
    <body>
        <h2>HTML accesskey attribute</h2>
 
        <!-- The accesskey attribute used here -->
        <a
            href="https://ide.geeksforgeeks.org/tryit.php"
            accesskey="g"
            >GeeksforGeeks
        </a>
    </body>
</html>

Output: 

Supported Browsers:

The browser supported by accesskey attribute are listed below: 


Article Tags :