JavaScript Element ariaRowCount Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Instance property

What You’ll Learn

Element.ariaRowCount is an instance property that reflects the aria-rowcount attribute. Learn how it declares the total number of rows in a table, grid, or treegrid, when it matters for partial DOM tables, and how to get or set it from JavaScript—with five examples and try-it labs.

01

Kind

Instance property

02

Type

String (integer)

03

Meaning

Total row count

04

Reflects

aria-rowcount

05

Status

Baseline widely

06

Used on

Table / grid / treegrid

Introduction

Assistive technologies need to know how tall a data table or grid is—even when only some rows are rendered in the DOM (virtualized or paged rows).

aria-rowcount declares that total. The DOM property ariaRowCount lets you read and update it from JavaScript.

JavaScript
const el = document.getElementById("semantic-table");
console.log(el.ariaRowCount); // "100"
el.ariaRowCount = "101";
💡
Beginner tip

The value is a string containing an integer (for example "100"), not a Number. Pair it with ariaColCount when you also declare total columns.

Understanding the Property

MDN: the ariaRowCount property of the Element interface reflects the value of the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.

  • Reflected attribute — mirrors aria-rowcount.
  • Get / set — readable and writable string containing an integer.
  • Total rows — may be larger than rows currently in the DOM.
  • Baseline — widely available since October 2023 (MDN).

📝 Syntax

JavaScript
ariaRowCount

Value

A string which contains an integer—the total number of rows.

ItemDetail
Typestring (e.g. "100", "101")
Reflectsaria-rowcount
Applies totable, grid, treegrid (and related patterns)
Often paired witharia-colcount, aria-rowindex on cells

📋 Semantic Table (MDN Shape)

MDN sets aria-rowcount="100" on a table (representing the full data set, not only the visible rows), then updates it to "101" via the property:

JavaScript
<table
  id="semantic-table"
  role="table"
  aria-label="Semantic Elements"
  aria-describedby="semantic_elements_table_desc"
  aria-rowcount="100"
>
  <caption id="semantic_elements_table_desc">
    Semantic Elements to use instead of ARIA's roles
  </caption>
  <thead role="rowgroup">
    <tr role="row">
      <th role="columnheader" aria-rowindex="1">ARIA Role</th>
      <th role="columnheader" aria-rowindex="1">Semantic Element</th>
    </tr>
  </thead>
  <tbody role="rowgroup">
    <tr role="row">
      <td role="cell" aria-rowindex="11">header</td>
      <td role="cell" aria-rowindex="11">h1</td>
    </tr>
    <tr role="row">
      <td role="cell" aria-rowindex="16">header</td>
      <td role="cell" aria-rowindex="16">h6</td>
    </tr>
  </tbody>
</table>
JavaScript
let el = document.getElementById("semantic-table");
console.log(el.ariaRowCount); // 100
el.ariaRowCount = "101";
console.log(el.ariaRowCount); // 101

Prefer a real <table> with semantic headers when you can. Use ARIA row counts when you need to describe a larger logical data set than what is currently rendered.

⚡ Quick Reference

GoalCode / note
Readel.ariaRowCount
Writeel.ariaRowCount = "101"
HTML attributearia-rowcount="100"
With columnsAlso set aria-colcount when needed
MDN statusBaseline Widely available

🔍 At a Glance

Four facts about Element.ariaRowCount.

Kind
get / set

Instance

Type
string

Integer text

Reflects
aria-rowcount

Attribute

Baseline
widely

Oct 2023+

Examples Gallery

Examples follow MDN Element: ariaRowCount. Labs use a small table so you can safely read and write the property.

📚 Getting Started

Read the reflected value and follow MDN’s table update.

Example 1 — Read ariaRowCount

Log the total row count from a table.

JavaScript
const el = document.getElementById("semantic-table");
console.log(el.ariaRowCount);

// HTML includes: aria-rowcount="100"
Try It Yourself

How It Works

The property returns the attribute string. If the attribute is missing, many browsers return null.

Example 2 — MDN Update to "101"

MDN: change total row count from 100 to 101.

JavaScript
let el = document.getElementById("semantic-table");
console.log(el.ariaRowCount); // 100
el.ariaRowCount = "101";
console.log(el.ariaRowCount); // 101
Try It Yourself

How It Works

Assigning the property updates the reflected aria-rowcount attribute. Keep the count consistent with your real (or logical) row set.

📈 Column Pair, Attribute Sync & Snapshot

Practice pairing with column count and verify reflection.

Example 3 — Pair with ariaColCount

Declare both total rows and total columns on a table.

JavaScript
const table = document.createElement("table");
table.setAttribute("role", "table");
table.ariaRowCount = "100";
table.ariaColCount = "2";
document.body.appendChild(table);

console.log({
  ariaRowCount: table.ariaRowCount,
  ariaColCount: table.ariaColCount
});
Try It Yourself

How It Works

MDN’s example uses both attributes together so AT knows the full logical size of the data set.

Example 4 — Property vs getAttribute

Confirm the attribute stays in sync after a write.

JavaScript
const el = document.createElement("table");
el.setAttribute("aria-rowcount", "100");
document.body.appendChild(el);

el.ariaRowCount = "101";
console.log({
  fromProperty: el.ariaRowCount,
  fromAttribute: el.getAttribute("aria-rowcount"),
  same: el.ariaRowCount === el.getAttribute("aria-rowcount")
});
Try It Yourself

How It Works

Prefer ariaRowCount in script; keep the attribute for HTML markup.

Example 5 — Support Snapshot

Feature-detect and remember when row count helps.

JavaScript
console.log({
  supported: "ariaRowCount" in Element.prototype,
  tip: "Declare total rows even if not all are in the DOM",
  valueType: "string containing an integer",
  status: "Baseline Widely available (MDN)"
});
Try It Yourself

How It Works

Update ariaRowCount when the logical height of your data set changes (for example rows added or removed in a grid UI).

🚀 Common Use Cases

  • Data tables that expose a total row count to AT.
  • Virtualized grids where only some rows are rendered.
  • Treegrids and spreadsheet-like widgets with dynamic rows.
  • Keeping script and markup aligned without manual setAttribute.
  • Pairing with aria-colcount for full table dimensions.

🔧 How It Works

1

Table / grid has a logical height

You know the total number of rows in the data set.

Model
2

Set aria-rowcount / ariaRowCount

Expose that total as a string integer on the container.

Declare
3

DOM may show fewer rows

Virtualized UIs still report the full count.

Partial DOM
4

Assistive tech understands size

Users get accurate table/grid dimensions.

📝 Notes

Browser Support

Element.ariaRowCount is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline Widely available

Element.ariaRowCount

String integer — reflects aria-rowcount (total rows in table/grid/treegrid).

Baseline Widely available
Google Chrome Supported (ARIA reflection)
Yes
Microsoft Edge Supported (ARIA reflection)
Yes
Mozilla Firefox Supported (ARIA reflection)
Yes
Apple Safari Supported (ARIA reflection)
Yes
Opera Follow Chromium support
Yes
Internet Explorer No ariaRowCount IDL — use setAttribute
No
ariaRowCount Baseline

Bottom line: Use ariaRowCount to get/set aria-rowcount. Keep the string count aligned with your logical row set, especially for virtualized tables. Pair with ariaColCount when you also declare total columns.

Conclusion

ariaRowCount reflects aria-rowcount so tables, grids, and treegrids can declare their total row count as a string integer—even when not every row is in the DOM. Update it from JavaScript when the logical height of your data changes.

Continue with ariaRowIndex, ariaColCount, ariaRoleDescription, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use a string integer that matches the logical row total
  • Pair with aria-colcount when declaring full size
  • Prefer semantic <table> markup when possible
  • Update the count when rows are added or removed
  • Use row indexes when only a subset of rows is shown

❌ Don’t

  • Leave a stale count after the grid height changes
  • Treat the value as a Number type in APIs that expect strings
  • Invent ARIA tables when a native table is enough
  • Mismatch visible rows vs declared total without reason
  • Forget accessible names / captions on complex tables

Key Takeaways

Knowledge Unlocked

Five things to remember about ariaRowCount

Reflected aria-rowcount string for total rows.

5
Core concepts
📝 02

String integer

total rows

Type
🔍 03

Table / grid

treegrid too

Use
04

Baseline

widely available

Status
🎯 05

Partial DOM

still declare total

Tip

❓ Frequently Asked Questions

It reflects the aria-rowcount attribute as a string containing an integer that defines the total number of rows in a table, grid, or treegrid.
No. MDN marks Element.ariaRowCount as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string containing an integer (for example "100" or "101"), not a Number type.
When the full row set is not all in the DOM at once (for example a virtualized or partially rendered table), so assistive technologies still know the total row count.
aria-rowcount is the total rows; aria-colcount is the total columns. MDN’s example sets both on the same table.
Yes. Reading and writing ariaRowCount updates the reflected aria-rowcount attribute.
Did you know?

MDN’s sample table sets aria-rowcount="100" while only showing a few rows, and uses aria-rowindex on cells (11, 16, 18…) so AT knows where those visible rows sit in the full data set.

Next: Element ariaRowIndex

Learn the reflected aria-rowindex property for 1-based row positions.

ariaRowIndex →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful