The HTMLTableElement.tBodies read-only property returns a live HTMLCollection of the table bodies.
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. E.g.
<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.
HTMLCollectionObject = table.tBodies
length(mytable.tBodies);
| Specification | Status | Comment |
|---|---|---|
| Document Object Model (DOM) Level 2 HTML Specification The definition of 'tBodies' in that specification. | Obsolete | Returns a collection of the table bodies (including implicit ones) |
| Document Object Model (DOM) Level 2 HTML Specification The definition of 'Interface HTMLCollection' in that specification. | Obsolete | An HTMLCollection is a list of nodes. An individual node may be accessed by either ordinal index or the node's name or id attributes. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | Yes | Yes | Yes | Yes | Yes |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | ? | Yes | Yes | Yes | Yes | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/tBodies