Firefox Tomorrow

web api instance method

HTMLTableElement: deleteCaption() method

View on MDN ↗

The HTMLTableElement.deleteCaption() method removes the <caption> element from a given <table>. If there is no <caption> element associated with the table, this method does nothing.

Syntax

deleteCaption()

Parameters

None.

Return value

None (undefined).

Examples

This example uses JavaScript to delete a table’s caption.

HTML

<table>
  <caption>
    This caption will be deleted!
  </caption>
  <tbody>
    <tr>
      <td>Cell 1.1</td>
      <td>Cell 1.2</td>
    </tr>
    <tr>
      <td>Cell 2.1</td>
      <td>Cell 2.2</td>
    </tr>
  </tbody>
</table>

JavaScript

let table = document.querySelector("table");
table.deleteCaption();

Result

Interactive exampleOpen the canonical MDN source to run this embedded demo.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.