Delete the first row in a table:
The deleteRow() method removes the row at the specified index from a table.
Tip: Use the insertRow() to create and insert a new row.
The deleteRow() method is supported in all major browsers.
Value | Description |
---|---|
index | Required in Firefox and Opera, optional in IE, Chrome and Safari. An integer that specifies the position of the row to delete (starts
at 0). The value of 0 results in that the first row will be deleted. The value of -1 can also be used; which result in that the last row will be deleted. This parameter is required in Firefox and Opera, but optional in Internet Explorer, Chrome and Safari. If this parameter is omitted, deleteRow() removes the last row in IE and the first row in Chrome and Safari. |
Return Value: | No return value |
---|
Delete the row you click on:
Create and delete row(s):
HTML reference: HTML <tr> tag