In JavaScript, ariaPosInSet reflects the aria-posinset attribute: a string integer for an element’s position in a set of listitems or treeitems (MDN) — especially when not all items are in the DOM.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.ariaPosInSet. Start with this line.
JavaScript
element.ariaPosInSet
Call
What it does
element.ariaPosInSet
Primary signature.
Built into the browser. Read or assign el.ariaPosInSet — no import required.
Library declarations
JavaScript
element.ariaPosInSet
Parameters
Parameter
Description
Value
Optional. String integer ≥ 1
aria-setsize
Required. Full set size, or -1
Custom elements
Optional. ElementInternals.ariaPosInSet
Return Value
Return Value
Description
*
The current value of el.ariaPosInSet.
JavaScript Examples
Example 1 — Get and Set (MDN)
Read the current position, then update it to "3".
JavaScript
let el = document.getElementById("article2");
console.log(el.ariaPosInSet); // "2"
el.ariaPosInSet = "3";
console.log(el.ariaPosInSet); // "3"
Write via the property. Attribute updates immediately.
Read via getAttribute. Same value as ariaPosInSet.
Write via the attribute. Property reflects the change.
Use digit strings such as "2", not bare numbers for attribute intent.
Compatibility
Browser Support
Element.ariaPosInSet 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 ariaPosInSet
Reflects aria-posinset — position within a set of items.
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.ariaPosInSet
Not supported
ariaPosInSetBaseline support
Bottom line: Safe in modern browsers. Use with aria-setsize when only a subset of items is in the DOM. See the MDN Element.ariaPosInSet reference.
Frequently Asked Questions
It reflects the aria-posinset attribute as a string containing an integer — the element's number or position in the current set of listitems or treeitems.
No. MDN marks Element.ariaPosInSet as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
Use aria-posinset together with aria-setsize on each item in the set. ariaPosInSet is the position; ariaSetSize (or aria-setsize) is the total count in the set.
The property is a string containing an integer (for example "2" or "3"), not a JavaScript number type.
MDN reads aria-posinset="2" from article2 via ariaPosInSet, then assigns "3" to update the reflected attribute.
When not all items in a set are present in the DOM (for example a virtualized list). If every item is in the DOM, the browser can usually calculate position and aria-posinset is unnecessary.