Table deleteCaption() method

Definition and Usage

deleteCaption() Method to remove the first <caption> element(and its content).

Tip:To create a new <caption> element for the table, use createCaption() method.

See also:

HTML Reference Manual:HTML <caption> Tag

Instance

Example 1

Remove the <caption> element from the table:

document.getElementById("myTable").deleteCaption();

Try It Yourself

Example 2

Create and delete <caption> elements:

function myCreateFunction() {
  var table = document.getElementById("myTable").createCaption();
  table.innerHTML = "<b>My table caption</b>";
{}
function myDeleteFunction() {
  document.getElementById("myTable").deleteCaption();
{}

Try It Yourself

Syntax

tableObject.deleteCaption()

Parameters

None.

Return Value:

No Return Value.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support