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 |
浏览器兼容性
加载中…