Element: ariaLevel 屬性
Element 介面的 ariaLevel 屬性反映了 aria-level 屬性的值,該屬性定義了元素在結構中的層級。
注意: 儘可能使用 HTML 的 h1 或其他正確的標題級別,因為它們具有內建的語義,不需要 ARIA 屬性。
值
包含整數的字串。
示例
在此示例中,ID 為 main-heading 的元素上的 aria-level 屬性設定為 "1"。使用 ariaLevel,我們將值更新為 "2"。
html
<div role="heading" id="main-heading" aria-level="1">
This is a main page heading
</div>
js
let el = document.getElementById("main-heading");
console.log(el.ariaLevel); // "1"
el.ariaLevel = "2";
console.log(el.ariaLevel); // "2"
規範
| 規範 |
|---|
| 無障礙富網際網路應用程式 (WAI-ARIA) # dom-ariamixin-arialevel |
瀏覽器相容性
載入中…