You are here: Reference > JavaScript > client-side > HTML DOM > methods > createTFoot (table)

createTFoot method (table)

Browser support:
Creates an empty tfoot element and adds it to the current table.
If a tfoot already exists on the current table, the createTFoot method returns it and does not create a new one.
Another way to create a tfoot element is to use the createElement method. To remove the footer from a table, use the deleteTFoot method.


object.createTFoot ( );
You can find the related objects in the Supported by objects section below.

Return value:

Returns the newly created or the existing tfoot element.

Example HTML code 1:

This example illustrates the use of the createTFoot method:
    <script type="text/javascript">
        function CreateFooter () {
            var table = document.getElementById ("myTable");
            if (!table.tFoot) {
                var footer = table.createTFoot ();
                var row = footer.insertRow (0);
                var cell = row.insertCell (0);
                cell.innerHTML = "<b>Footer for the table.</b>";
    <table id="myTable" border="1px">
                <td>This text is inside the table.</td>
    <br /><br />
    <button onclick="CreateFooter ();">Create a footer for the table!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content