title: JS: Object #<HTMLDivElement> has no method 'createElement'
body: <p>Im trying to let a js script create some tags with an for loop, but i get the error Object # has no method 'createElement'</p>
  
  <p>Its the following function:</p>
  
  <pre><code>function tabListRefresh() {
    // Get Container
    var container = document.getElementById("tabListContainer");
  
    // Clear container
    container.innerHTML = "";
  
    // Create tags
    for( var k=0; k&lt;tabs.length; k++ ) {
  
      // Create div tag
      var div = container.createElement("div");
      div.setAttribute("class", "tab");          
  
      // Include title into tag
      div.innerHTML = tabs[k][0] + " ";
  
      // Create closetab-icon
      var closebtn = div.createElement("button");    
      div.setAttribute("type", "button");        
      div.setAttribute("class", "closetab");    
      closebtn.innerHTML = "&amp;times;";
  
   }
  
  
    /* XML Structure:
        &lt;div class="tab"&gt;
          Dashboard
          &lt;button type="button" class="closetab"&gt;&amp;times;&lt;/button&gt;
        &lt;/div&gt;
                                                                      */
  }
  </code></pre>