I'm trying to replace new lines in java script to <br>'s. But...
$(this).html($(this).text().replace(/(\n|\r)/gm, "<br>")); and the others function like this one replaced first line too. So I'm getting formatted text with enters at the start. Example
<br> (?) <br> (?) Text <br> How to solve this issue ?
$(".class").each(function(){ $(this).html($(this).text().replace(/\\n/g, "<br/>")); });
.replace(/(\r\n|\n|\r)/gm,"<br/>")? What does So I'm getting formatted text with to enters at the start. mean?