Inserting a newline into a pre tag (IE, Javascript)
Posted
by Itay
on Stack Overflow
See other posts from Stack Overflow
or by Itay
Published on 2008-10-12T11:24:29Z
Indexed on
2010/04/27
10:33 UTC
Read the original article
Hit count: 211
In IE when I insert text into a <pre>
tag the newlines are ignored:
<pre id="putItHere"></pre>
<script>
function putText() {
document.getElementById("putItHere").innerHTML = "first line\nsecond line";
}
</script>
Using \r\n
instead of a plain \n
does not work.
<br/>
does work but inserts an extra blank line in FF, which is not acceptable for my purposes.
© Stack Overflow or respective owner