UK [inˈsə:t rəu] US [ɪnˈsɚt ro]

[理] insert row

javascript insertRow() method syntax

Function:Used to insert a new row at the specified position in the table.

Syntax:tableObject.insertRow(index)

Returns:Returns a TableRow, representing the newly inserted row.

Description:This method creates a new TableRow object, representing a new tag, and inserts it into the table at the specified position. The new row will be inserted before the row at index. If index is equal to the number of rows in the table, new rows will be appended to the end of the table. If the table is empty, the new row will be inserted into a new section, which will itself be inserted into the table.

Note:You can use the TableRow.insertCell() method to add content to newly created rows.

javascript insertRow() method example

   
Row1 cell1 Row1 cell2
Row2 cell1 Row2 cell2


Run instance »

Click the "Run instance" button to view the online instance