Latest web development tutorials
 

HTML DOM TableRow Object


TableRow Object

The TableRow object represents an HTML <tr> element.

Access a TableRow Object

You can access a <tr> element by using getElementById():

Example

var x = document.getElementById("myTr");
Try it Yourself »

Tip: You can also access a <tr> element by searching through the rows collection of a table.

Create a TableRow Object

You can create a <tr> element by using the document.createElement() method:

Example

var x = document.createElement("TR");
Try it Yourself »

TableRow Object Collections

Collection Description
cells Returns a collection of all <td> or <th> elements in a table row

TableRow Object Properties

Property Description
align Not supported in HTML5. Use style.textAlign instead.
Sets or returns the horizontal alignment of the content within a table row
bgColor Not supported in HTML5. Use style.backgroundColor instead.
Sets or returns the background color of a table row
ch Not supported in HTML5.
Sets or returns an alignment character for cells in a table row
chOff Not supported in HTML5.
Sets or returns the horizontal offset of the ch property
height Not supported in HTML5. Use style.height instead.
Sets or returns the height of a table row.
rowIndex Returns the position of a row in the rows collection of a table
sectionRowIndex Returns the position of a row in the rows collection of a tbody, thead, or tfoot
vAlign Not supported in HTML5. Use style.verticalAlign instead.
Sets or returns the vertical alignment of the content within a table row

TableRow Object Methods

Method Description
deleteCell() Deletes a cell from the current table row
insertCell() Inserts a cell into the current table row

Standard Properties and Events

The TableRow object also supports the standard properties and events.


Related Pages

HTML tutorial: HTML Tables

HTML reference: HTML <tr> tag