You are here: Reference > JavaScript > client-side > HTML DOM > properties > caption (table)

caption property (table)

Browser support:
Returns the caption element of the current table object.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

The caption element of the table object or null if it is not defined.
Default: null.

Example HTML code 1:

This example illustrates the use of the caption property:
    <script type="text/javascript">
        function GetCaption () {
            var table = document.getElementById ("myTable");
            alert (table.caption.innerHTML)
    <table id="myTable">
        <caption>The contents of the caption</caption>
            <td>First cell in the table</td>
    <button onclick="GetCaption ();">Get the contents of the caption!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content