HTMLTableElement.deleteRow()

The HTMLTableElement.deleteRow() method removes a row from the table. If the amount of rows to delete, specified by the parameter, is greater or equal to the number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception INDEX_SIZE_ERR is thrown.

Syntax

JavaScript
HTMLTableElement.deleteRow(index)

Return Value

no return value

Parameters

index
index is an integer representing the row that should be deleted.
However, the special index -1 can be used to remove the very last row of a table.

Example

JavaScript
mytable.deleteRow(1);
// delete the second row

Specification

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/htmltableelement/deleterow

API HTML DOM HTMLTableElement Method NeedsBrowserCompatibility NeedsSpecTable Reference Référence