The HTMLElement.accessKeyLabel read-only property returns a String that represents the element's assigned access key (if any); otherwise it returns an empty string.
label = element.accessKeyLabel
var node = document.getElementById('btn1');
if (node.accessKeyLabel) {
node.title += ' [' + node.accessKeyLabel + ']';
} else {
node.title += ' [' + node.accessKey + ']';
}
node.onclick = function () {
var p = document.createElement('p');
p.textContent = 'Clicked!';
node.parentNode.appendChild(p);
};
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
| 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. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | ? | No | 8 | ? | ? | ? |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | ? | ? | No | 8 | ? | ? | ? |
element.accessKey
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKeyLabel