このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Element: ariaLabel プロパティ

Baseline 2023
Newly available

Since ⁨October 2023⁩, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

ariaLabelElement インターフェイスのプロパティで、aria-label 属性の値を反映し、現在の要素にラベル付けする文字列値を定義します。

文字列または null です。

この例では、close-button という ID を持つ要素の aria-label 属性には "Close" が設定されています。ariaLabel を使用して、値を "Close dialog" に更新します。

html
<button aria-label="Close" id="close-button">X</button>
js
let el = document.getElementById("close-button");
console.log(el.ariaLabel); // "Close"
el.ariaLabel = "Close dialog";
console.log(el.ariaLabel); // "Close dialog"

仕様書

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# dom-ariamixin-arialabel

ブラウザーの互換性