tr insertCell() method
tr object
Definition and Usage
The insertCell() method is used to insert an empty element at a specified position in a row of an HTML table.
Syntax
trObject.insertCell(
index
)
| Value | Description | |
|---|---|---|
| index | This method creates a new element and inserts it at the specified position in the row. | The new cell is inserted before the cell currently at the position specified by index. If index equals the number of cells in the row, the new cell is appended to the end of the row. |
Browser support





All major browsers support the insertCell() method
Example
Example
The example below inserts a cell into a table row:
| First cell | Second cell | Third cell |
Try it »
More examples
Add a new row to a table, then add cells and content
tr object