Table createCaption() method
Table object
Definition and Usage
The createCaption() method is used to get or create an 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 element.
**Note:** To remove the table's caption element, use deleteCaption() method.
Syntax
tableObject.createCaption()
Browser support





All major browsers support the createCaption() method
Example
Example
The example below creates a caption for a table:
| cell 1 | cell 2 |
| cell 3 | cell 4 |
Try it »
Table object