Abs Abs - 1 year ago 76
Javascript Question

Remove parent but keep children using jQuery

I would like to remove the parent and keep the children in my HTML using jQuery. This works:


However, it removes the text and comment node types - how can I amend this so that I keep the text?

Happy to do this with pure Javascript too.

Answer Source

As @Cᴏʀʏ says, unwrap() should help you acheive this.

Alternatively, you could do something like this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download