tags:

views:

31

answers:

1

Hello Everyone just like my title states, I am having issues with IE8 and innerHTML. For whatever reason, when I make an ajax call which returns an html block and try to insert it into an element using innerHTML, the browser gives me an error "Unknown Error Code: 0".

The interesting part of this is that, if the message response does not have html element, innerHTML works. My code is like so:

setTimeout(function() {

 element.innerHTML = context.response.message;
}, 1000).bind(context)

WORKS:

context.response.message = 'String';

Does not WORK:

context.response.message = '<p>String</p>';
A: 

Ok ok, I figured it out... For what ever reason, IE8 and IE7 does not like:

Problem:
<p>Hi
   <p>Hi again</p>
</p>

Fix:
<div>Hi
   <p>Hi again</p>
</div>

Firefox seems to not care if you nest p tags, however, IE 8 and 7 poop on itself :(.

Thanks for your response.

ericg
Don't thnk you can nest <p>.. by definition the paragraph ends when a </p> or <p> is encountered.. Probably IE is breaknig because the HTML is badly formated.. If you remove the </p> it should work also.
Gonçalo Queirós
A paragraph cannot contain block level elements, including <p> itself.http://www.w3.org/TR/html401/struct/text.html#h-9.3.1
Garrett