tHead property

The tHead property stores a reference to the thead of a table.

Syntax

javascripttable.tHead;

Example

We color a table header red:

html<table id="table">
  <thead>
    <tr>
      <th>header1</th>
      <th>header2</th>
      <th>header3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>value</td>
      <td>value</td>
      <td>value</td>
    </tr>
    <tr>
      <td>value</td>
      <td>value</td>
      <td>value</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>result</td>
      <td>result</td>
      <td>result</td>
    </tr>
  </tfoot>
</table>
javascriptlet table = document.querySelector('#table');
table.tHead.style.color = 'red';

See also

  • the tFoot property
    that contains tfoot of a table
  • the tBodies property
    that contains tbody of a table
  • the rows property
    that contains rows of a table
  • the cells property
    that contains table cells