0
I created Divs using:
$('.images').find('img').replaceWith(function () {
return '<div class="resize">' + this.outerHTML + '</div>'
});
HTML output:
<div class="images">
<div class="resize"><img src="img1.jpg"></div>
<div class="resize"><img src="img2.jpg"></div>
<div class="resize"><img src="img3.jpg"></div>
</div>
Now I’d like to revert to that, it’s possible?
<div class="images">
<img src="img1.jpg">
<img src="img2.jpg">
<img src="img3.jpg">
</div>
but from there, it will erase the images, no?
– Ivan Ferrer
yes, remove erases everything including your descendants,
– Pedro Martins
rather uses unwrap to remove the parent element
– Pedro Martins
Thanks, it worked here: https://jsfiddle.net/34b9sdpd/
– Ivan Ferrer