New Line in Textarea to be converted to <br/>

I don't know if this will work for you, but you can try it out

This one converts <br/> to new line in textarea

$(this).val().split("<br/>").join("\n");

And this one converts it back

boxText.split("\n").join("<br/>");

This works for me


This will replace line breaks to HTML break tags. The different combinations are to cover the different browsers/systems and how line breaks are interpreted.

$(this).val().replace(/\r\n|\r|\n/g,"<br />")

This will bring it back to new lines - also covering how different browsers interpret innerHTML.

boxText.replace(/<br\s?\/?>/g,"\n");