MDN self-hosted library · e01.org

HTMLTableElement: deleteTHead() method

HTML DOM

HTML DOM

The deleteTHead() method of the HTMLTableElement interface removes the first thead element child from a given table, if any.

Syntax

deleteTHead()

Parameters

None.

Return value

None (undefined).

Examples

This example uses JavaScript to delete a table's header.

HTML

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Occupation</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Bob</td>
      <td>Plumber</td>
    </tr>
    <tr>
      <td>Jim</td>
      <td>Roofer</td>
    </tr>
  </tbody>
</table>

JavaScript

const table = document.querySelector("table");
table.deleteTHead();

Result

Examples

Specifications

Browser compatibility

See also

  • HTMLTableElement.createTHead()
  • HTMLTableElement.deleteCaption()
  • HTMLTableElement.deleteTFoot()