response.text
contains the html
source of google.com
.
How come the html
source is not wrapping inside my <pre>
?
Current solution creates a huge side scrolling area, I'd like any text that goes beyond the window width to wrap.
I want to avoid use of innerHTML
in this solution.
var pre = document.createElement('pre');
pre.appendChild(document.createTextNode(response.text));
document.getElementById("body").appendChild(pre);
css
for <pre>
..
pre {
outline: 1px solid #ccc;
padding: 5px;
margin: 5px;
white-space: -moz-pre-wrap;
}