TableData headers attribute
Definition and Usage
headers
Sets or returns the value of the headers attribute.
<td> headers attribute Specifies a list of header cells that contain information about the current data cell.
See also:
HTML Reference Manual:HTML <td> Tag
Instance
Example 1
Return the headers attribute value of the <td> element with id "myTd":
var x = document.getElementById("myTd").headers;
Example 2
Display the cell titles of the 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>"; }
Example 3
Change the headers attribute of the <td> element with id "myTd":
document.getElementById("myTd").headers = "newValue";
Syntax
Return the headers attribute:
tabledataObject.headers
Set the headers attribute:
tabledataObject.headers = header_ids
Attribute Value
Value | Description |
---|---|
header_ids | A space-separated list of ids of one or more header cells related to the table cell. |
Technical Details
Return Value: | A string containing a list of header cell identifiers separated by spaces. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <td> headers Attribute