Element: thuộc tính ariaSort
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 ariaSort của giao diện Element phản ánh giá trị của thuộc tính aria-sort, cho biết các phần tử con trong phần tử hiện tại được sắp xếp theo thứ tự nào.
Giá trị
Một chuỗi có giá trị là một trong các giá trị sau: "ascending", "descending", "none", hoặc "other".
Ví dụ
Trong ví dụ này, thuộc tính aria-sort trên phần tử có ID là sortable-header được đặt là "ascending". Sử dụng ariaSort, chúng ta cập nhật giá trị thành "descending".
html
<table>
<thead>
<tr>
<th id="sortable-header" aria-sort="ascending">Cột có thể sắp xếp</th>
</tr>
</thead>
<tbody>
<tr><td>Dữ liệu 1</td></tr>
<tr><td>Dữ liệu 2</td></tr>
</tbody>
</table>
js
let el = document.getElementById("sortable-header");
console.log(el.ariaSort); // "ascending"
el.ariaSort = "descending";
console.log(el.ariaSort); // "descending"
Đặc tả kỹ thuật
| Thông số kỹ thuật |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-ariasort> |