JavaScript deleteRow() Method Tutorial

In this section, we will learn that the deleteRow() method is and how to use it in JavaScript.

JavaScript delete row: deleteRow() Method

The JavaScript deleteRow() method is used to remove a <tr> (row) from a table.

Note: if you want to add a new row to a table, you can use the insertRow() method instead.

deleteRow() Method Syntax:

tableElement.deleteRow(index);

deleteRow() Method Parameter

The method takes one argument, and that is the index number of the row we want to remove from the target table.

Also, the value 0 means the first row of the table and the value -1 means the last row.

deleteRow() Method Return Value

The method does not return a value.

Example: delete row JavaScript

See the Pen delete row JavaScript by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies