我怎樣才能去除這個div以外的p標籤(我做不是想要刪除測試div)。jQuery刪除標籤的任一側
<p>
<div class='test'>
content here
<img />
</div>
</p>
我想會是這個結果......
<div class='test'>
content here
<img />
</div>
我知道有一個類似的問題在這裏:jQuery: How do I remove surrounding div tags?,但沒有得到它在我的處境工作
我ve已嘗試
$('p .test').replaceWith($('.test));
但當然,那只是選擇沙龍幻燈片div,而不是p bef礦石它。
可能重複的[刪除父分區,但不是內部的東西](http://stackoverflow.com/questions/5201834/remove-the-parent-div-but-not-whats-inside-the -parent) – 2012-02-09 11:38:36
順便說一句。在'p'裏面有'div'是無效的。 – 2012-02-09 11:38:56