Can we remove the parent element? | Sololearn: Learn to code for FREE!

0

Can we remove the parent element?

Can we remove the parent element if we click the child element using JS code?

4/6/2021 2:33:13 PM

Wai

5 Answers

New Answer

+3

This is one very simple example. There are other ways as well. https://code.sololearn.com/WLwJr1U2pmi4/?ref=app

+1

I wish you can find something similar here in this link. https://stackoverflow.com/questions/170004/how-to-remove-only-the-parent-element-and-not-its-child-elements-in-javascript

0

child.parentNode.removeChild(child)

0

Can we leave the child here but remove the parent?

0

Thank you very much!