Remove tag around a text node using javascript

前端 未结 8 1947
夕颜
夕颜 2021-02-06 14:12

If I have some HTML that looks like this:

This is some text that is being written with a high
8条回答
  •  余生分开走
    2021-02-06 15:05

    You get the text, and replace the span with it:

    var wrap = $('.highlight');
    var text = wrap.text();
    wrap.replaceWith(text);
    

提交回复
热议问题