GO-V.ORG
As seen in

HTMLTableElement: rows property

HTML DOM

HTML DOM

The **`rows`** read-only property of the HTMLTableElement interface returns a live HTMLCollection of all tr elements that are a child of the given table element, or a child of one of the table's thead, tbody, and tfoot children. The members of the `<thead>` appear first, followed by members of the `<tbody>` and the table itself, and members of the `<tfoot>` come last, sorted by tree order within each group.

Although the property is read-only, the returned object is live and is automatically updated when the `HTMLTableElement` changes.

## Value

A live HTMLCollection of HTMLTableRowElement objects.

## Examples

```js
const myRows = myTable.rows;
const firstRow = myTable.rows[0];
const lastRow = myTable.rows.item(myTable.rows.length - 1);
```

This demonstrates how you can use both indexed access and the HTMLCollection.item() method to obtain individual rows in the table.

## Specifications

## Browser compatibility

## See also

- HTMLTableElement.insertRow()
- HTMLTableElement.deleteRow()

source: MDN Web Docs mirror · page

Cite this

"HTMLTableElement: rows property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/rows

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·