Name
TableRow — a <tr> element in an HTML table
Inherits from
Node, Element
Synopsis
A TableRow object represents a row (a <tr> element) in an HTML table and
defines properties and methods for working with the TableCell
elements of the row.
Properties
readonly HTMLCollectioncellsAn array-like object of TableCell objects representing the
<td>and<th>elements in this row.readonly longrowIndexThe index of this row in the table.
readonly longsectionRowIndexThe position of this row within its section (i.e., within the
<thead>,<tbody>, or<tfoot>in which it is contained).
Methods
void deleteCell(long
index)
deleteCell(long
index)This method deletes the cell at the specified
index in the row.
Element insertCell([long
index])
insertCell([long
index])This method creates a new <td> element, inserts it into the
row at the specified position, and then returns it. The new cell
is inserted immediately before the cell that is currently at the
position specified by index. If
index is omitted, is -1, or is equal to
the number of cells in the row, the new cell is appended to the
end of the row.
Note that this convenience method inserts <td> data cells only. If you need
to add a header cell into a row, you must create and insert the
<th> element using
Document.create Element()
and Node.insertBefore() or related
methods.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access