Latest web development tutorials
 

Table caption Property

< Table Object

Example

Alert the text inside a caption element:

alert(document.getElementById("myTable").caption.innerHTML);
Try it Yourself »

Definition and Usage

The caption property returns the <caption> element of a table.

The <caption> element defines a caption for a table.

Note: The <caption> tag must be inserted immediately after the <table> tag. You can specify only one caption per table. By default, the caption will be centered above the table.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The caption property is supported in all major browsers.


Syntax

tableObject.caption

Technical Details

Return Value: The <caption> element of the table, or null if it is not defined

Related Pages

HTML reference: HTML <caption> tag


< Table Object