【发布时间】:2012-02-09 11:36:33
【问题描述】:
如何删除这个 div 之外的 p 标签(我确实不想删除测试 div)。
<p>
<div class='test'>
content here
<img />
</div>
</p>
我想要的结果是……
<div class='test'>
content here
<img />
</div>
我知道这里有一个类似的问题:jQuery: How do I remove surrounding div tags?,但在我的情况下无法使用
我试过了
$('p .test').replaceWith($('.test));
当然,这只是选择了沙龙幻灯片 div,而不是它之前的 p。
【问题讨论】:
-
顺便说一句。在
p中包含div是无效的。