English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM accessKey attribute

HTML DOM Element Object

accessKeyAttribute sets or returnsaccessKeyElement properties.

accessKeyAttribute sets the key pressed to jump to this element's keystroke

Note:The way to access shortcuts varies in different browsers:

  • Chrome, Safari, Opera 15 +, IE:[ALT] + Shortcut Key

  • Previous versions of Opera15:[SHIFT] [ESC] + Shortcut Key

  • Firefox:[ALT] [SHIFT] + Shortcut Key

Syntax:

Return accessKey attribute:

element.accessKey

Set accessKey attribute:

element.accessKey = character
document.getElementById("demo").accessKey = "p";
Test See‹/›

Browser Compatibility

All browsers fully support the accessKey attribute:

Attribute
accessKeyYesYesYesYesYes

Attribute Value

ValueDescription
characterSpecify a shortcut key, and users can jump to the element using this shortcut key

Technical Details

Return Value:Characters on the keyboard
DOM Version:DOM Level1

More Examples

Get the access key of the link:

var x = document.getElementById("demo").accessKey;
Test See‹/›

Related References

HTML Reference:HTML accessKey attribute

HTML DOM Element Object