Javascript Reference - HTML DOM Table tFoot Property








The tFoot property returns a reference to the <tfoot> element of a table.

Browser Support

tFoot Yes Yes Yes Yes Yes

Syntax

var v = tableObject.tFoot

Return Value

A reference to the <tfoot> element of the table, or null if it is not defined





Example

The following code shows how to output the innerHTML of <tfoot>.


<!DOCTYPE html>
<html>
<head>
<style>
table, td {<!--from   ww w.j  a  va  2s. co  m-->
    border: 1px solid black;
}
</style>
</head>
<body>

<p>Click the button to return the innerHTML of the tfoot element.</p>

<table id="myTable">
   <thead>
     <tr>
       <th>Item</th>
       <th>Price</th>
     </tr>
   </thead>
   <tfoot>
     <tr>
       <td>A</td>
       <td>$1</td>
     </tr>
   </tfoot>
   <tbody>
     <tr>
       <td>B</td>
       <td>$10</td>
     </tr>
   </tbody>
</table><br>

<button onclick="myFunction()">test</button>

<script>
function myFunction() {
    console.log(document.getElementById("myTable").tFoot.innerHTML);
}
</script>

</body>
</html>

The code above is rendered as follows: