Remove tag around a text node using javascript

前端 未结 8 1917
夕颜
夕颜 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 14:58

    element = document.getElementById("span id");
    element.parentNode.insertBefore(element.firstChild, element);
    element.parentNode.removeChild(element);
    

提交回复
热议问题