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

瀏覽器相容性