I have following jQuery with \n
to be replaced with <br />
tag.
var msg = JSON.parse(ev.data)
var test = msg.message;
test.replace(/\n/, "<br />");
//OR
test.replace(/\n/g, "<br />");
//OR
test.replace(/\\n/g, "<br />");
alert(test);
I am unable to get linebreak. I tried all of them but failed. I think string test is not going through replace function.