Javascript: replacing newlines with <br/> working in FF and SAFARI and not working in IE
Posted
by Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2010-05-06T12:31:23Z
Indexed on
2010/05/06
12:38 UTC
Read the original article
Hit count: 295
JavaScript
I was thinking that replacing \n with
with javascript was quite a simple task, but it seems not to be so. Posts in Ask Ben or StackOverflow suggest that something as simple as:
dst= dst.replace (/\n/g, "<br/>");
$("div.descr").html(dst);
will get the job done. Indeed, this work in FF and Safari but not in IE.
Text has been created in a textarea and then stored in a database, then retrieved without further processing. It works using FF on windows and Safari on Mac. IE on windows, nada. Is it a major bug in my head? Is it a JQuery issue?
Have some idea about how to solve this? And possible reason for?
Many thanks
© Stack Overflow or respective owner