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/>"));
});
")`? What does _So I'm getting formatted text with to enters at the start._ mean? – Satpal Aug 05 '14 at 11:02