In JavaScript, ariaLevel reflects the aria-level attribute: a string integer that defines the hierarchical level of an element within a structure (MDN) — for example a heading level or a tree depth.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.ariaLevel. Start with this line.
JavaScript
element.ariaLevel
Call
What it does
element.ariaLevel
Primary signature.
Built into the browser. Read or assign el.ariaLevel — no import required.
Library declarations
JavaScript
element.ariaLevel
Parameters
Parameter
Description
Value
Required. String integer ≥ 1
Custom elements
Optional. ElementInternals.ariaLevel
Return Value
Return Value
Description
*
The current value of el.ariaLevel.
JavaScript Examples
Example 1 — Get and Set (MDN)
Read the current level, then update it to "2".
JavaScript
let el = document.getElementById("main-heading");
console.log(el.ariaLevel); // "1"
el.ariaLevel = "2";
console.log(el.ariaLevel); // "2"
Write via the property. Attribute updates immediately.
Read via getAttribute. Same value as ariaLevel.
Write via the attribute. Property reflects the change.
Keep values as digit strings (not numbers like 2 without quotes in assignment intent — use "2").
Compatibility
Browser Support
Element.ariaLevel is marked Baseline Widely available on MDN (since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
Element ariaLevel
Reflects aria-level — hierarchical level as a string integer.
WidelyAvailable
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerNo Element.ariaLevel
Not supported
ariaLevelBaseline support
Bottom line: Safe in modern browsers. Prefer h1–h6 for document headings; use ariaLevel with role="heading" or tree-like UIs when needed. See the MDN Element.ariaLevel reference.
Frequently Asked Questions
It reflects the aria-level attribute as a string containing an integer, which defines the hierarchical level of an element within a structure (MDN).
No. MDN marks Element.ariaLevel as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string containing an integer greater than or equal to 1, for example "1", "2", or "3".
No when you can avoid it. MDN: where possible use an HTML h1 or other correct heading level — they have built-in semantics and do not require ARIA attributes.
When you use role="heading" (required with aria-level) or other hierarchical structures (for example tree rows) and the DOM ancestry cannot express the level alone.
Yes. Reading and writing ariaLevel updates the reflected aria-level attribute.