Table caption attribute
Definition and Usage
caption
Properties return the <caption> element of the table.
<caption> element defines the table title.
Note:<caption> tag must follow the <table> tag. You can only specify one title for each table. By default, the title will be centered above the table.
See also:
HTML Reference Manual:HTML <caption> Tag
Example
Prompt the text inside the title element:
alert(document.getElementById("myTable").caption.innerHTML);
Syntax
tableObject.caption
Technical Details
Return Value: | The <caption> element of the table, if undefined, is null . |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |