Element: ariaPosInSet 属性

Baseline 2023
新推出

自 ⁨2023 年 10 月⁩ 以来,此功能已在最新设备和浏览器版本中得到支持。此功能可能无法在旧设备或浏览器上运行。

Element 接口的 ariaPosInSet 属性反映了 aria-posinset 属性的值,该属性定义了一个元素在当前列表项集或树项集中的编号或位置。

包含整数的字符串。

示例

在此示例中,ID 为 article2 的元素上的 aria-posinset 属性设置为“2”。使用 ariaPosInSet,我们将值更新为“3”。

html
<article id="article1" aria-posinset="1">…</article>
<article id="article2" aria-posinset="2">…</article>
js
let el = document.getElementById("article2");
console.log(el.ariaPosInSet); // "2"
el.ariaPosInSet = "3";
console.log(el.ariaPosInSet); // "3"

规范

规范
无障碍富互联网应用程序 (WAI-ARIA)
# dom-ariamixin-ariaposinset

浏览器兼容性