我有以下输入:
<p>
<span class="highlight">
Some text <b>that can have formatted components too</b>.
</span>
And some more text here of course.
</p>
我想实现以下输出:
<p>
Some text <b>that can have formatted components too</b>.
And some more text here of course.
</p>
我正在使用 jquery,它有一个.unwrap()
功能,但如果我去
$('.highlight').unwrap()
,它会删除<p>
. :(
手动破解 DOM 似乎很麻烦。你知道任何简短的解决方案吗?