Reputation: 35
<div id="A"></div>
<div id="B"></div>
<div id="D"></div>
<div id="E"></div>
<div id="C"></div>`
How can I move <div id="C"></div>
between id B and D with pure javascript (without JQuery)?
Upvotes: 1
Views: 87
Reputation: 78525
You can use insertBefore:
var C = document.getElementById("C");
var D = document.getElementById("D");
D.parentElement.insertBefore(C, D);
Upvotes: 4