Easy Tutorial
❮ Jsref Random Met Element Setattributenode ❯

Table createCaption() Method


Definition and Usage

The createCaption() method is used to get or create a <caption> element in a table.

Note: If a caption element already exists in the table, the createCaption() method returns the existing caption instead of creating a new <caption> element.

Tip: To remove the caption element from a table, use the deleteCaption() method.

Syntax


Browser Support

All major browsers support the createCaption() method.


Example

The following example creates a caption for a table:


❮ Jsref Random Met Element Setattributenode ❯