Computer >> Computer tutorials >  >> Programming >> HTML

Create a shortcut key to activate an element in HTML


To create a shortcut key, use the access attribute in HTML. Let us say you need to add a shortcut key to the following link

Hadoop Tutorial

To let shortcut keys work correctly on Firefox web browser (Windows), you need to add it like this −

[Alt] [Shift] + accesskey

Example

You can try to run the following code to create a shortcut key to activate an element in HTML −

<!DOCTYPE html>
<html>
   <body>
      <a href="https://www.tutorialspoint.com/hadoop/index.htm" accesskey="h">Hadoop Tutorial</a>
      <p>We have set ALT+SHIFT+H to access the Hadoop Tutorial</p>
   </body>
</html>