+ 1
Change parent
Can I change the parent of an element in java script? For example I have div1 in div2 and I want to move div1 to div3. Can I?
1 Resposta
+ 1
Sure: https://code.sololearn.com/WfPvQESWtXv1/?ref=app
If you look at the HTML page, div2 is a child of div1.
The JS changes this and alerts the parent of div2's id which it says is now div3.