Element: ariaLabel プロパティ

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

ブラウザーの互換性

BCD tables only load in the browser