title: Remove element by tag name
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12489364/use-remove-on-multiple-elements">use remove() on multiple elements</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to remove all elements that have a tag name of "label". I have the following code. It works to some degree, but it only removes 1 label. The other 5 still remain. How can I change the code to remove all "label" tags?</p>
  
  <pre><code>element = document.getElementsByTagName("label");
  for (index = 0; index &lt; element.length; index++) {
      element[index].parentNode.removeChild(element[index]);
  }
  </code></pre>