Change parent | Sololearn: Learn to code for FREE!


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?

11/12/2019 7:40:27 PM


1 Answer

New Answer


Sure: 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.