The HTMLTableElement.deleteRow()
method removes a row from the table. If the number 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.
HTMLTableElement.deleteRow(index)
no return value
index
index
is an integer representing the row that should be deleted.-1
can be used to remove the very last row of a table.mytable.deleteRow(1); // delete the second row
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | Yes | Yes | Yes | Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | ? | Yes | Yes | Yes | Yes | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/deleteRow