HTML | DOM TableHeader Object Last Updated : 23 May, 2022 Comments Improve Suggest changes Like Article Like Report The TableHeader object in HTML DOM is used to represent the HTML <th> element. The <th> element can be accessed by using getElementById() method. Syntax: It is used to access <th> element. document.getElementById("id"); It is used to create <th> element. document.createElement("th"); TableHeader Object Properties: PropertyDescriptionabbrThis property is used to set or return the value of the abbr attribute.alignThis property is used to set or return the horizontal alignment of the content in a data cell.vAlignThis property is used to set or return the vertical alignment of the content within a cell.widthThis property is used to set or return the width of a data cell.axisThis property is used to set or return a comma-separated list of related data cells.backgroundThis property is used to set or return the background image of a data cell.bgColorThis property is used to set or return the background color of a table.cellIndexThis property is used to return the position of a cell in the cells collection of a table row.chThis property is used to set or return an alignment character for a data cell.chOffThis property is used to set or return the horizontal offset of the ch property.colSpanThis property is used to set or return the value of the colspan attribute.headersThis property is used to set or return the value of the headers attribute.heightThis property is used to set or return the height of a data cell.noWrapThis property is used to set or return whether the content in a cell can be wrapped.rowSpanThis property is used to set or return the value of the rowspan attribute. Example 1: This example use getElementById() method to access <th> element. HTML <!DOCTYPE html> <html> <head> <!-- style to set border --> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM TableHeader Object</h2> <table> <tr> <th id = "table">Username</th> </tr> <tr> <td>geeks</td> </tr> </table> <p> Click on button to change th element. </p> <button onclick = "myGeeks()"> Click Here! </button> <!-- Script to access th element --> <script> function myGeeks() { var tab = document.getElementById("table"); tab.innerHTML = "User Handle"; } </script> </body> </html> Output: Before click on the button: After click on the button: Example 2: This example use document.createElement() method to create <th> element. HTML <!DOCTYPE html> <html> <head> <!-- style to set border --> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM TableHeader Object</h2> <table id = "tab"> <tr id = "mytable"> </tr> </table> <p>Click the button to create a th element.</p> <button onclick = "myGeeks()"> Click Here! </button> <!-- script to create th element --> <script> function myGeeks() { /* Create Table Header element */ var tab_row = document.createElement("TH"); /* Set the the text node */ var text = document.createTextNode("Table Header Content"); tab_row.appendChild(text); document.getElementById("mytable").appendChild(tab_row); } </script> </body> </html> Output: Before click on the button: After click on the button: Supported Browsers: Google ChromeEdgeMozilla FirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML | DOM TableHeader Object D divyatagoel0709 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Form autocomplete Property The Form autocomplete property in HTML DOM is used to set or return of the autocomplete attribute. The autocomplete attribute is used to specify whether the autocomplete attribute has "on" or "off" value. When the autocomplete attribute is set to on so the browser will automatically complete the val 2 min read HTML | DOM Textarea rows Property The DOM Textarea rows Property is used to set or return the value of a rows attribute of a textarea field. The rows attribute specifies the number of visible text lines for the control i.e the number of rows to display. Syntax: It is used to Return the rows property:textareaObject.rowsIt is used to 2 min read HTML DOM Video Object The Video object in HTML DOM represents an <video> element. The video element can be accessed by using getElementById() method. Syntax: To access a video object: document.getElementById("videoId");where id is assigned to the <video> tag.To create a video object: document.createElement("V 4 min read HTML | DOM Input Month Object The Input Month Object in HTML DOM is used to represent an HTML input element with type= "month" attribute. The input element with type= "month" attribute can be accessed by using getElementById() method. Syntax: It is used to access <input> element with type="month" attribute.document.getElem 3 min read HTML | DOM Style flexGrow Property The HTML DOM style flexGrow property is used as a measure to determine how much an item will grow relative to the rest of the flexible items inside the same container. Syntax: Return flexGrow property:object.style.flexGrowSet flexGrow property:object.style.flexGrow = "number|initial|inherit" Propert 3 min read HTML | DOM Input Email Object The Input Email Object in HTML DOM is used to represent the HTML input element with type="email" attribute. The input element with type="email" attribute can be accessed by using getElementById() method. Syntax: It is used to access input email object.document.getElementById("id");It is used to crea 3 min read HTML | DOM Storage setItem() Method The setItem() method is used to set the storage object item which is specified by the user. This storage object can be a localStorage object or sessionStorage object. Syntax: For local storage: localStorage.setItem(keyname, value) For session storage: sessionStorage.setItem(keyname, value) Parameter 1 min read HTML | DOM Textarea required Property The DOM Textarea required Property is used to set or return the Whether that the input element must be filled out before submitting the Form. This Property is used to reflect the HTML required attribute.Syntax: It is used to Return the required property: textareaObject.requiredIt is used to Set the 2 min read HTML | DOM Style verticalAlign Property This property is used to set or return the vertical alignment of the content in an element. Syntax: Return VerticalAlign :object.style.verticalAlignSet VerticalAlign :object.style.verticalAlign = value Properties: ValueDescriptionlengthIt is used to raise or lower an element by some given length.%It 4 min read HTML | DOM Input Datetime Object The Input Datetime Object in HTML DOM is used to represent an HTML input element with type= "datetime". The input element with type= "datetime" can be accessed by using getElementById() method. Syntax: It is used to access input Datetime object.document.getElementById("id");It is used to create inpu 3 min read Like