I have written the following code. But it is removing only
not
var docDesc = docDescription.replace(/(&nb
What about:
var docDesc1 = docDescription.replace(/(<br ?\/?>)*/g,"");
I using simple replace to remove
and br
tag.
var str = docDescription.replace(/ /g, '').replace(/\<br\s*[\/]?>/gi, '');
Remove br
with remove() or replaceWith()
$('br').remove();
or
$('br').replaceWith(function() {
return '';
});