tôi có đầu vào sau:Làm thế nào để loại bỏ một nhịp tại chỗ?
<p>
<span class="highlight">
Some text <b>that can have formatted components too</b>.
</span>
And some more text here of course.
</p>
Và tôi muốn đạt được kết quả như sau:
<p>
Some text <b>that can have formatted components too</b>.
And some more text here of course.
</p>
Tôi đang sử dụng jquery và nó có một chức năng .unwrap()
, nhưng nếu tôi đi $('.highlight').unwrap()
nó loại bỏ <p>
. :(
thủ hack DOM có vẻ như một rắc rối. Bạn có biết bất kỳ giải pháp ngắn?
'$ (". highlight "). parent (" p "). html ($ (". highlight "). text());' –