 <pre><code>document.getElementsByClassName('shiftTrRow') ^ </code></pre> <p>returns a <a href="https://developer.mozilla.org/en-US/docs/DOM/Nodelist" rel="nofollow">NodeList</a>, i.e. an array of elements. You will need to loop over them and remove every of them on its own (but watch out, the collection is live and will shrink while you remove the elements).</p> <p>Also, the <a href="https://developer.mozilla.org/en-US/docs/DOM/document.getElementsByClassName" rel="nofollow"><code>getElementsByClassName</code></a> may return elements that are no rows of that table at all, resulting in the <code>NOT FOUND</code> exception you receive.</p> <p>However, the simplest way to remove rows from a table is its <a href="https://developer.mozilla.org/en-US/docs/DOM/table.deleteRow" rel="nofollow"><code>deleteRow</code> method</a>:</p> <pre><code>var table = document.getElementById('resultsTable'); while (table.rows.length &gt; 0) table.deleteRow(0); </code></pre>