Create a <caption> element with some text for a table:
The createCaption() method creates an empty <caption> element and adds it to the table.
Note: If a <caption> element already exists on the table, the createCaption() method returns the existing one, and does not create a new one.
Tip: To remove the <caption> element from a table, use the deleteCaption() method.
The createCaption() method is supported in all major browsers.
None |
Return Value: | The newly created (or an existing) <caption> element |
---|
Create and delete a <caption> element:
HTML reference: HTML <caption> tag