javascript

Dynamically populate an element styled with white-space: pre

Assume: $ = document.getElementById; pre = $(‘pre-text-element’); //pre-text-element is the ID of my pre tag element You cannot use: $(‘element’).innerHTML = ‘line1\nline2’; //will not work in IE7 You must do this: e = $(‘element’); while(kid=e.firstChild) { e.removeChild(kid) } //remove all children in the e.appendChild(‘line1\nline2’); Lame, huh?

‘no element found’ in firebug or firefox javascript console (part 2)

I was right. If the server sends a response and the ‘Content-Type’ attribute is ‘text/xml’, you must send at least a root node so the xml parser that is built into Mozilla’s XMLHTTPRequest object doesn’t cak and give you a ‘no element found’ Javascript error. This could be an issue for those of us who …

‘no element found’ in firebug or firefox javascript console (part 2) Read More »