/

HTML / CSS / JavaScript Tutorial

JavaScript table object method: deleteRow()

[this page | pdf | back links]

The deleteRow() method of the JavaScript DOM object corresponding to the HTML <table> element removes a <tr> element from the table.

 

It has the following syntax with the following parameters:

 

object.deleteRow(index)

 

Parameter

Required / Optional

Description

index

Required (see below)

Index position from where row is removed (index starts at 0). Using zero deletes the first row, using -1 deletes the last row.

 

Note: the index parameter is required by some browsers but optional for others.

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile