title: Create <div> and append <div> dynamically
body: <p>I am trying to create a <code>&lt;div&gt;</code> dynamically, with an appended <code>&lt;div&gt;</code> inside. I have this so far which works:</p>
  
  <pre><code>var iDiv = document.createElement('div');
  iDiv.id = 'block';
  iDiv.className = 'block';
  document.getElementsByTagName('body')[0].appendChild(iDiv);
  </code></pre>
  
  <p>I am just having trouble creating and appending the second div to the first div.</p>
  
  <p>I essentially want to do this as the final markup:</p>
  
  <pre><code>&lt;div id="block" class="block"&gt;
     &lt;div class="block-2"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>