Propriété tHead

La propriété tHead stocke une référence vers le thead du tableau.

Syntaxe

javascripttableau.tHead;

Exemple

Colorons en rouge l'en-tête du tableau :

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>total</td>
      <td>total</td>
      <td>total</td>
    </tr>
  </tfoot>
</table>
javascriptlet table = document.querySelector('#table');
table.tHead.style.color = 'red';

Voir aussi

  • la propriété tFoot,
    qui contient le tfoot du tableau
  • la propriété tBodies,
    qui contient le tbody du tableau
  • la propriété rows,
    qui contient les lignes du tableau
  • la propriété cells,
    qui contient les cellules du tableau