值
字符串或 null。
示例
在本示例中,ID 为 close-button 的元素上的 aria-label 属性被设置为“关闭”。通过使用 ariaLabel,我们将该值更新为“关闭对话框”。
html
<button aria-label="关闭" id="close-button">X</button>
js
let el = document.getElementById("close-button");
console.log(el.ariaLabel); // “关闭”
el.ariaLabel = "关闭对话框";
console.log(el.ariaLabel); // “关闭对话框”
规范
| 规范 |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-arialabel> |