I have a textarea and I set its text to a string with \\n
in it. I would expect that to represent a line break.
$(\"#ConfirmEmailText\").text(\
try
text = text.replace("\n","<br/>");
Did you try?
text = text.replace(/(\r\n|\r|\n)/g, '\n');
Or use the DOM structure's .nodeValue property.
EDIT : i may have not been clear. Instead of using innerHTML to set the text try using nodeValue
Set the value
not the innerText
;
$("#ConfirmEmailText").val("test\n\ntest\ntest");