Inserting a newline into a pre tag (IE, Javascript)
- by Itay
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.