HTML accesskey Attribute

The accesskey attribute in HTML is used to set a shortcut key to activate or focus on an element.

Following is the syntax−

<element accesskey="char">

Above, char is the shortcut key.

On Windows, set the access key for different browsers−

Web BrowserWindows OS
Safari[Alt] + accesskey
Chrome[Alt] + accesskey
Firefox[Alt] [Shift] + accesskey

Let us now see an example to implement the accesskey attribute on Google Chrome web browser on Windows−


 Live Demo

<!DOCTYPE html>
<h2>Reference Links</h2>
   <a href="" accesskey="t">Tools</a><br>
   <a href="" accesskey="c">Online Compiler</a><br>
   <a href="" accesskey="w">Whiteboard</a><br>
<p>Use <kbd>ALT </kbd> + <kbd>accesskey</kbd> on Chrome</p>