Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLElement
  4. accessKeyLabel

HTMLElement: accessKeyLabel property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

TheHTMLElement.accessKeyLabelread-only property returns a string containing the element'sbrowser-assigned access key (if any); otherwise it returns an empty string.

Example

JavaScript

js
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

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

Result

Specifications

Specification
HTML
# dom-accesskeylabel

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp