javascript : How to add a node/element to a specific-indexed location?
<p>I have an element("p") which has say 10 children(10 div's).Based on user request i want to add a div under the "p" element to say 5th or 2ed position in the "p" Dom tree.</p>

<pre><code>var div = document.createElement("div");  //Comment  Append
div.id="div"+divId;
div.className="div";
div.appendChild(document.createTextNode(divText));
var p = document.getElementById("comment");
length=p.childNodes.length;
</code></pre>

<p>Say p has a length of 15 and i want to add the div to the 13th position(adding it and NOT replacing it -- not replaceChild)</p>

<p>If i try traversing to the 13th position and do a <code>parentNode.appendChild</code> it gets appended(obviously) to the last position(15th position will be the new Div)</p>

<p>i want to add a div or any element to an Indexed location in a child list.</p>

<p>Please help.</p>
