HTMLTableElement: createTBody() method - Web APIs | MDN (original) (raw)

Baseline Widely available

The createTBody() method ofHTMLTableElement objects creates and returns a new element associated with a given

.

Note: Unlike HTMLTableElement.createTHead() andHTMLTableElement.createTFoot(), createTBody() systematically creates a new <tbody> element, even if the table already contains one or more bodies. If so, the new one is inserted after the existing ones.

Syntax

Parameters

None.

Return value

Examples

let myBody = myTable.createTBody();
// Now this should be true: myBody === myTable.tBodies.item(myTable.tBodies.length - 1)

Specifications

Specification
HTML Standard # dom-table-createtbody-dev

Browser compatibility

BCD tables only load in the browser