MDN self-hosted library · e01.org

HTMLTableElement: tBodies property

HTML DOM

Open notebook · 2 cells web-api-instance-property upstream source

HTML DOM

The tBodies read-only property of the HTMLTableElement interface returns a live HTMLCollection of all tbody element children of the given table.

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

The collection returned includes implicit tbody elements. For example:

<table>
  <tr>
    <td>cell one</td>
  </tr>
</table>

The HTML DOM generated from the above HTML will have a tbody element even though the tags are not included in the source HTML.

Value

A live HTMLCollection of HTMLTableSectionElement (which are all tbody) objects.

Examples

This snippet gets the number of bodies in a table.

myTable.tBodies.length;

Specifications

Browser compatibility

See also

  • HTMLTableElement.caption
  • HTMLTableElement.tFoot
  • HTMLTableElement.tHead
  • HTMLTableElement.createTBody()