In IE when I insert text into a tag the newlines are ignored:
The workaround can be found in the page linked to in the accepted answer. For ease of use here it is:
if (elem.tagName == "PRE" && "outerHTML" in elem) { elem.outerHTML = "" + str + ""; } else { elem.innerHTML = str; }
" + str + "