Element: thuộc tính 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.
Thuộc tính ariaLabel của giao diện Element phản chiếu giá trị của thuộc tính aria-label, định nghĩa một giá trị chuỗi gắn nhãn cho phần tử hiện tại.
Giá trị
Một chuỗi hoặc null.
Ví dụ
Trong ví dụ này, thuộc tính aria-label trên phần tử có ID close-button được đặt thành "Close". Sử dụng ariaLabel chúng ta cập nhật giá trị thành "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"
Đặc tả kỹ thuật
| Thông số kỹ thuật |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-arialabel> |