<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function init(){
document.getElementById('test2').innerHTML = '1 2';
}
</script>
<style type="text/css">
#test{
white-space:pre;
}
#test2{
white-space:pre;
}
</style>
<title></title>
</head>
<body onload="init();">
<div id="test">
1 2
</div>
<div id="test2"></div>
</body>
</html>
Here is an example page showing my problem. I have two divs. Each has this text '1 2' with white-space. The only difference is that one is injected dynamically and one is in the html itself.
If you open the above page in IE7, the text in div test2 doesn't respect white space. How can i get the same behavior for the text that is dynamically injected??
P.S. My doctype is triggering standards mode on IE7.