title: How to remove children in JavaScript
body: <p>What is the equivalent of the following JQuery code in JavaScript:</p>
  
  <pre><code>$('div').children().remove();
  </code></pre>
  
  <p>I tried following but it says length is not defined:</p>
  
  <pre><code>var nodes = document.getElementsByTagName('div').childNodes;
  for(var i=0; i&lt; nodes.length; i++) {
  
           nodes[i].remove();
  
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/jsfi/RyGKV/604/" rel="nofollow">Fiddle</a></p>