JQuery to remove multiple br tag

by Subramanian 2014-05-19 17:02:46

JQuery to remove multiple br tag :
The below function is used to remove multiple br tag from string.

Method 1:

$('br').each(function () {
    if ($(this).next().is('br')) {
        $(this).next().remove();
    }
});

Method 2:
$('.clsname').each(function(){
			$(this).html($(this).html().replace(/(<br>s*){2,2}/g,'<br>'));
	});

1303
like
0
dislike
0
mail
flag

You must LOGIN to add comments