Free webinar! How to Make Generative AI Work for You
Get my free ticket0
Can we remove the parent element?
Can we remove the parent element if we click the child element using JS code?
5 Answers
+ 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!