You can try setting html of div, also the closing /
of img tag is missing.
$('.photo').html($('.photo a').html())
質問
<div class="photo">
<a href="#"><img src="/media/image.jpg"></a>
</div>
Using unwrap()
is awesome, but right now I have to unwrap the img
above using an older version of jQuery, removing the link and retaining just the image inside of the div
.
解決
You can try setting html of div, also the closing /
of img tag is missing.
$('.photo').html($('.photo a').html())
他のヒント
$('.photo a').replaceWith($('.photo a').html());