TableData headers attribute

Definition and usage

headers Set or return the value of the headers attribute.

<td> headers attribute Define a list of header cells that contain information about the current data cell.

See also:

HTML Reference Manual:HTML <td> Tag

Example

Example 1

Return the headers attribute value of the <td> element with id "myTd":

var x = document.getElementById("myTd").headers;

Try it yourself

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>";
}

Try it yourself

Example 3

Change the headers attribute of the <td> element with id "myTd":

document.getElementById("myTd").headers = "newValue";

Try it yourself

Syntax

Return headers attribute:

tabledataObject.headers

Set headers attribute:

tabledataObject.headers = header_ids

Attribute Value

Value Description
header_ids Isa o ilang header cell na may kaugnayan sa table cell na hinahati ng espasyo na id list.

Technical Details

Halimbawa ng Balyo: String, naglalaman ng listahan ng identifier ng header cell na hinahati ng espasyo.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <td> Header Ating Tungkulin