JS Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
<p>I'm trying to add dynamically information from an XML and add to an div. My idea is to add the new div inside the existing div (not mandatory.. i can also actually add to the existing div)</p>

<p><strong>JS</strong></p>

<pre><code>    var newDiv = document.createElement("div");  //new Div
    newDiv.appendChild(sideTab);
    var existingDiv = document.getElementById("vertical");  //Existing div
    document.body.insertBefore(newDiv,existingDiv);
</code></pre>

<p>sideTab will have something like that:</p>

<pre><code> &lt;ul class ="tab" &gt;
     &lt;li&gt;&lt;a href="#" class="tab"&gt; Something&lt;/a&gt;&lt;/li&gt;
 &lt;/ul&gt;
</code></pre>

<p>Existing div</p>

<pre><code>    &lt;div class="left" id="vertical"&gt;
</code></pre>

<p>But when i execute i get this error:
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.</p>