TableData headers Property
Example
Return the value of the headers attribute of a <td> element with id "myTd":
var x = document.getElementById("myTd").headers;
Try it Yourself »
Description
The headers property sets or returns the value of the headers attribute.
The headers attribute specifies a list of header cells containing header information for the current data cell.
Browser Support
Property | |||||
---|---|---|---|---|---|
headers | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the headers property:
tabledataObject.headers
Set the headers property:
tabledataObject.headers = header_ids
Property Values
Value | Description |
---|---|
header_ids | Specifies a space-separated list of id's to one or more header cells the table cell is related to |
Technical Details
Return Value: | A String, containing a space-separated list of header cell identifiers |
---|
More Examples
Example
Display cell headers of second row:
var table = document.getElementById("myTable");
var txt = "";
var i;
for (i = 0; i < table.rows[1].cells.length; i++) {
txt = txt + table.rows[1].cells[i].headers + "<br>";
}
Try it Yourself »
Example
Change the value of the headers attribute of a <td> element with id "myTd":
document.getElementById("myTd").headers = "newValue";
Try it Yourself »
Related Pages
HTML reference: HTML <td> headers attribute
❮ TableData Object