title: Getting all the child elements of a parent div
body: <p>I'm trying to get the IDs and Classes of all children elements in a parent DIV.</p>
  
  <p>I've tried the following:</p>
  
  <p><strong>The HTML</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var children = [].slice.call(document.getElementById('container').getElementsByTagName('*'), 0);
  document.getElementById('output').innerHTML = children.join('\&lt;/br&gt;');</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="container"&gt;
    &lt;div id="A"&gt;&lt;/div&gt;
    &lt;div id="B"&gt;&lt;/div&gt;
    &lt;div id="C"&gt;&lt;/div&gt;
    &lt;div class="D"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="output"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But the output is:</p>
  
  <pre><code>[object HTMLDivElement]
  [object HTMLDivElement]
  [object HTMLDivElement]
  [object HTMLDivElement]
  </code></pre>
  
  <p>Any ideas of what I am doing wrong here please?</p>
  
  <p><a href="https://jsfiddle.net/v47nngyo/" rel="nofollow">JSFiddle</a></p>