HTMLTableElement.deleteRow()

  • Revision slug: DOM/table.deleteRow
  • Revision title: table.deleteRow
  • Revision id: 309639
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment id / name attribute.

Revision Content

{{ DomRef() }}

Summary

deleteRow removes a row from the table.

Syntax

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

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

Exceptions

  • INDEX_SIZE_ERR
    thrown if the specified index is greater or equal to the number of available rows or when it is negative and not equal to the special index -1

Specification

Revision Source

<div>{{ DomRef() }}</div>

<h2 id="Summary" name="Summary">Summary</h2>
<p><strong>deleteRow</strong> removes a row from the table.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="syntaxbox">
<em>HTMLTableElement</em>.deleteRow(<em>index</em>)</pre>

<h3 id="Return_Value" name="Return_Value">Return Value</h3>
<p>no return value</p>

<h3 id="Parameters" name="Parameters">Parameters</h3>
<dl>
  <dt>
    <code>index</code></dt>
  <dd>
    <code>index</code> is an integer representing the row that should be deleted.<br />
    However, the special index <code>-1</code> can be used to remove the very last row of a table.</dd>
</dl>

<h2 id="Example" name="Example">Example</h2>
<pre class="brush:js">
mytable.deleteRow(1);
// delete the second row</pre>

<h2 id="Exceptions" name="Exceptions">Exceptions</h2>
<ul>
  <li><code>INDEX_SIZE_ERR</code><br />
    thrown if the specified index is greater or equal to the number of available rows or when it is negative and not equal to the special index <code>-1</code></li>
</ul>

<h2 id="Specification" name="Specification">Specification</h2>
<ul>
  <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-13114938">deleteRow</a></li>
</ul>
Revert to this revision