accessKeyLabel

The HTMLElement.accessKeyLabel read-only property returns a String containing the element's browser-assigned access key (if any); otherwise it returns an empty string.

Syntax

label = element.accessKeyLabel

Example

JavaScript

var btn = document.getElementById('btn1');
var shortcutLabel = btn.accessKeyLabel || btn.accessKey;
btn.title += ' [' + shortcutLabel.toUpperCase() + ']';

btn.onclick = function () {
  var feedback = document.createElement('output');
  feedback.textContent = 'Pressed!';
  btn.insertAdjacentElement('afterend', feedback);
};

HTML

<button accesskey="h" title="Caption" id="btn1">Hover me</button>

Result

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLElement.accessKeyLabel' in that specification.
Living Standard No change from initial definition.
HTML 5.1 Recommendation Removed. pull w3c/html#144, issue w3c/html#99, WICG discussion.
HTML5
The definition of 'HTMLElement.accessKeyLabel' in that specification.
Recommendation Snapshot of HTML Living Standard, initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
accessKeyLabelChrome No support NoEdge No support NoFirefox Full support 8IE No support NoOpera ? Safari Full support 14WebView Android No support NoChrome Android No support NoFirefox Android Full support 8Opera Android ? Safari iOS Full support 14Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also