Suppose I have two DIVs on my page.
<body>
<div id="d1"></div>
<div id="d2"></div>
</body>
I want to create a new DIV dynamically using JavaScript and place it between d1 and d2. If I use the appendChild
method the new DIV is placed at the end.
Right now I can only think of paring the innerHTML
of the BODY and appending the new DIV at the desired location. Is there a better way?