TableHeader headers property
Example
Return the value of the headers property of the element with id "myTh":
var x = document.getElementById("myTh").headers;
document.getElementById("demo").innerHTML=x;
x The output is:
fname
Try it »
Definition and Usage
The headers property sets or returns the value of the headers property.
The headers property specifies a list of header cells that contains header information for the current data cell.
Browser support





All major browsers support the headers property.
Syntax
Return the headers property:
tableheaderObject
.headers
Set the headers property:
tableheaderObject
.headers=
header_ids
Attribute values
| Value | Description |
|---|---|
| header_ids | Specifies a space-separated list of ids of one or more header cells associated with the table cell. |
Technical Details
| Return Value: | String, containing a space-separated list of header cell identifiers. |
|---|
More examples
Example
Display the cell header of the second row:
var table = document.getElementById("myTable");
var txt = "";
for (var i=0; i
{
txt = txt + table.rows[1].cells[i].headers + "
";
}
document.getElementById("demo").innerHTML=txt;
Try it »
Example
Change the value of the headers property of the element with id "myTh":
document.getElementById("myTh").headers="newValue";
Try it »
Related Articles
HTML Reference Manual:HTML headers property
The TableHeader object