Limited availability
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.
const btn = document.getElementById("btn1");
const shortcutLabel = btn.accessKeyLabel || btn.accessKey;
btn.title += ` [${shortcutLabel.toUpperCase()}]`;
btn.onclick = () => {
const feedback = document.createElement("output");
feedback.textContent = "Pressed!";
btn.insertAdjacentElement("afterend", feedback);
};
HTML
<button accesskey="h" title="Caption" id="btn1">Hover me</button>
Result Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3