Table tFoot Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Table

Description

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

Return Value

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

The following code shows how to Alert the innerHTML of <tfoot>:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
table, td {
    border: 1px solid black;
}
</style>/*ww  w .  ja  va 2  s  . c o m*/
</head>
<body>

<table id="myTable">
   <thead>
     <tr>
       <th>Month</th>
       <th>Savings</th>
     </tr>
   </thead>
   <tfoot>
     <tr>
       <td>Sum</td>
       <td>$1</td>
     </tr>
   </tfoot>
   <tbody>
     <tr>
       <td>January</td>
       <td>$1</td>
     </tr>
     <tr>
       <td>February</td>
       <td>$8</td>
     </tr>
   </tbody>
</table><br>

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

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

</body>
</html>

Related Tutorials