THE WORLD'S LARGEST WEB DEVELOPER SITE

Table deleteCaption() Method

❮ Table Object

Example

Remove the <caption> element from a table:

document.getElementById("myTable").deleteCaption();
Try it Yourself »

Definition and Usage

The deleteCaption() method removes the first <caption> element (and its content) from the table.

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


Browser Support

Method
deleteCaption() Yes Yes Yes Yes Yes

Syntax

tableObject.deleteCaption()

Parameters

None


Technical Details

Return Value: No return value

More Examples

Example

Create and delete a <caption> element:

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

function myDeleteFunction() {
    document.getElementById("myTable").deleteCaption();
}
Try it Yourself »

Related Pages

HTML reference: HTML <caption> tag


❮ Table Object