how to remove   and
using javascript or jQuery?

前端 未结 8 1082
心在旅途
心在旅途 2020-12-06 05:38

I have written the following code. But it is removing only   not

var docDesc = docDescription.replace(/(&nb         


        
8条回答
  •  無奈伤痛
    2020-12-06 06:04

    You can do it like this:

    var cell = document.getElementsByTagName('br');
    var length = cell.length;
    for(var i = 0; i < length; i++) {
        cell[0].parentNode.removeChild(cell[0]);
    }
    

    It works like a charm. No need for jQuery.

提交回复
热议问题