Skip to content
Related Articles

Related Articles

HTML | DOM Table tFoot Property
  • Last Updated : 19 Feb, 2019

The Table tFoot property is used for returning a reference to the <tfoot> element of a table. The <tfoot> element is used for grouping the footer content in an HTML table.
It returns NULL if the <tfoot> element is not defined.

Syntax

tableObject.tFoot

Below program illustrates the Table TFoot() property :
Example: Alerting the innerHTML of <tfoot> element.




<!DOCTYPE html>
<html>
  
<head>
    <title>Table tFoot Property in HTML
  </title>
    <style>
        table,
        td {
            border: 1px solid green;
        }
          
        h1 {
            color: green;
        }
          
        h2 {
            font-family: Impact;
        }
          
        body {
            text-align: center;
        }
    </style>
</head>
  
<body>
  
    <h1>GeeksforGeeks</h1>
    <h2>Table tFoot Property</h2>
  
    <p>To return the innerHTML of the tfoot 
      element for the table, double-click the
      "Return Footer" button.</p>
  
    <table id="Courses" align="center">
        <thead>
            <tr>
                <th>Subject</th>
                <th>Courses</th>
            </tr>
        </thead>
        <tr>
            <td>Java</td>
            <td>Fork Java</td>
        </tr>
        <tr>
            <td>Python</td>
            <td>Fork Python</td>
        </tr>
        <tr>
            <td>Placements</td>
            <td>Sudo Placement</td>
        </tr>
        <tfoot>
            <tr>
                <td>Sample</td>
                <td>Footer</td>
            </tr>
        </tfoot>
  
    </table>
    <br>
  
    <button ondblclick="tfoot()">
      Return Footer
  </button>
  
    <script>
        function tfoot() {
            
            // returning reference of tFoot
            // using alert
            alert(document.getElementById(
              "Courses").tFoot.innerHTML);
        }
    </script>
  
</body>
  
</html>

Output:

Before clicking the button:

After clicking the button:

Supported Browsers:

  • Apple Safari
  • Internet Explorer
  • Firefox
  • Google Chrome
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :