HTMLTableElement: deleteCaption() Methode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die HTMLTableElement.deleteCaption() Methode entfernt das <caption>-Element aus einer gegebenen <table>. Wenn kein <caption>-Element mit der Tabelle verknüpft ist, führt diese Methode nichts aus.

Syntax

js
deleteCaption()

Parameter

Keine.

Rückgabewert

Keiner (undefined).

Beispiele

Dieses Beispiel verwendet JavaScript, um die Beschriftung einer Tabelle zu löschen.

HTML

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

JavaScript

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

Ergebnis

Spezifikationen

Specification
HTML
# dom-table-deletecaption-dev

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
deleteCaption

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support