Table deleteCaption() Method

Table Object Reference 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

Internet Explorer Firefox Opera Google Chrome Safari

The deleteCaption() method is supported in all major browsers.


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 Reference Table Object

SHARE THIS PAGE

COLOR PICKER

colorpicker