I would like to remove one div element, but without its children. For example, let's say that i have one div with id wrapper, and inside it 5 paragraphs.
I want to remove only the wrapper div, but to leave paragraphs alive. I have tried both remove() and detach(), but they both clean out the inner elements.
Any advice?
http://api.jquery.com/unwrap/ should do it:
The
.unwrap()
method removes the element's parent. This is effectively the inverse of the .wrap() method. The matched elements (and their siblings, if any) replace their parents within the DOM structure...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With