Javascript examples for DOM HTML Element:Table
The tHead property returns a reference to the <thead> element of a table.
A reference to the <thead> element of the table, or null if it is not defined
The following code shows how to Alert the innerHTML of <thead>:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style>/* ww w . ja v a 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").tHead.innerHTML); } </script> </body> </html>