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.
Syntax
label = element.accessKeyLabel
Example
JavaScript
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);
};
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
accessKeyLabel | Chrome No support No | Edge No support No | Firefox Full support 8 | IE ? | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 8 | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
See also
element.accessKey- The accesskey global attribute.
