YouTip LogoYouTip

Prop Tableheader Headers

# TableHeader headers Property [![Image 8: TableHeader Object Reference](#) TableHeader Object](#) ## Example Get the value of the headers attribute of a element with id="myTh": ```javascript var x = document.getElementById("myTh").headers; document.getElementById("demo").innerHTML=x; _x_ output will be: fname [Try it Β»](#) * * * ## Definition and Usage The headers property sets or returns the value of the headers attribute. The headers attribute specifies a list of header cell IDs, separated by spaces, that are associated with the current data cell. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The headers property is supported in all major browsers. * * * ## Syntax Get the headers property: _tableheaderObject_.headers Set the headers property: _tableheaderObject_.headers=_header_ids_ ## Property Values | Value | Description | | --- | --- | | _header_ids_ | A space-separated list of one or more header cell IDs that are associated with the table cell. | ## Technical Details | Return Value: | A string containing a space-separated list of header cell identifiers. | | --- | * * * ## More Examples ## Example Display the headers of the cells in the second row: ```javascript var table = document.getElementById("myTable"); var txt = ""; for (var i=0; i<table.rows.cells.length; i++) { txt = txt + table.rows.cells.headers + "
"; } document.getElementById("demo").innerHTML=txt; [Try it Β»](#) ## Example Change the value of the headers attribute of a element with id="myTh": ```javascript document.getElementById("myTh").headers="newValue"; [Try it Β»](#) * * * ## Related Articles HTML Reference: [HTML headers Attribute](#) * * TableHeader Object](#) [](#)[HTML DOM td / th Object](#) [HTML DOM t
← Dom Obj TimeProp Tableheader Colspan β†’