accessKey is a shortcut key specified for an element, so by pressing the accessKey the control will automatically move to the specified control.
accessKey must be used carefully, because it may conflict with other key bindings which are present in the browser.
In order to rectify it, browser allows some qualifying keys to be pressed with other keys.
Following are the qualifying keys used in different browsers,
- Chrome,Safari,IE,Opera 15+: ALT + Key.
- Opera before 15: SHIFT + ESC + Key.
- Firefox: ALT + SHIFT + Key.
Example 1 - set accessKey attribute value
In the above example, press the Add accessKey button. It sets the accessKey value for the textbox as t.
After pressing the button, press qualifying key + t to move the control to the textbox.
Example 2 - get accessKey attribute value
In the above example, press the get accessKey value button, an alert box will appear showing the access key value specified to the text box.