W3cubDocs

/Web APIs

HTMLTableElement: tBodies property

The HTMLTableElement.tBodies read-only property returns a live HTMLCollection of the bodies in a <table>.

Although the property is read-only, the returned object is live and allows the modification of its content.

The collection returned includes implicit <tbody> elements. For example:

html

<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

Examples

This snippet gets the number of bodies in a table.

js

mytable.tBodies.length;

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
tBodies 1 12 1 5.5 ≤12.1 3 4.4 18 4 ≤12.1 1 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/tBodies