Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Table createCaption() method

Table createCaption() method

Table Object Reference 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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the createCaption() method


Example

Example

The example below creates a caption for a table:

Runoob Tutorial(runoob.com)

    

        

        

    

    

        

        

    

cell 1 cell 2
cell 3 cell 4

Try it »


Table Object Reference Table object