[Solved] Can i change HTML structure with javascript? [closed]

[ad_1]

You can do like this, swap the elements order in the parent node.

var div1 = document.getElementsByClassName("div1")[0];

var div2 = document.getElementsByClassName("div2")[0];

div2.parentNode.insertBefore(div2, div1);

0

[ad_2]

solved Can i change HTML structure with javascript? [closed]