HTMLTableElement: createTFoot() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The createTFoot() method of the HTMLTableElement interface creates a <tfoot> element, inserts it as the last child of the given <table>, and returns it. If the table already has a <tfoot> element child, this method returns the first such child without creating one.

When creation is needed, this method creates and inserts the element directly, without requiring separate calls to methods such as Document.createElement() and Node.appendChild().

Syntax

js
createTFoot()

Parameters

None.

Return value

An HTMLTableSectionElement (which is always a tfoot).

Examples

js
const myFoot = myTable.createTFoot();
// Now this should be true: myFoot === myTable.tFoot

Specifications

Specification
HTML
# dom-table-createtfoot-dev

Browser compatibility

See also