I have the following code like
<div id="profile_description">
<p>Some Text with\nNew Line</p>
</div>
Here is my Javascript code for replace \n to < br >console.log($('#profile_description_field').html());
var str = $('#profile_description').html();
console.log(str);
str = str.replace(/(?:\r\n|\r|\n)/g, '<br>');
console.log(str);
The output is always Some Text with\nNew Line
What I doing wrong here? I have tried so many things ... I hope you have a idea. Thank you so much!
Jquery?str.replace(/\\n/g, "<br>")