Internet Explorer FIX: Unknown Runtime Error Using innerHTML & Ajax
I found that if you’re calling an ajax request that sets an innerHTML value you sometimes get an unknown runtime error in Internet Explorer. Of course everything works fine in Firefox (why isn’t Microsoft out of business yet?).
- Improperly nested or missing tags in the value you’re trying to set to innerHTML. This includes things like:
- lists of <li> with no outer <ul> or <ol> specified
- <p> tags that aren’t nested properly
- missing a closing tag like <h1> without matching </h1>
- Form tags nested within other form tags
- Fix nested tags, or try using <div> tags instead
- Remove nested <form> tags
This solution is courtesy of Pieces of Frakesh and other respective comment contributors 🙂
thank you ever so much and God bless you! been trying to get rid of the runtime error in ie for the past 6hrs – i just removed the form tags from my page and voila!
Thanks for posting this – that error was getting on my nerves!! Thanks to this post I have put this problem behind me and learned something new – thank you again!!!
And – I have no idea why Microsoft is still in business! IE is a pain, yet the most used (shouldn’t say popular!) browser out there. Manufacturers like Dell should probably have FF, Safari or Chrome installed on their new computers and set anything but IE to the default – except I’m sure Microsoft would pull some strings to prevent that.. oh well.
Not for me 🙁 I’ve cleaned my code, but this doesn’t help.
Post your code, I’ll take a look. You’re probably overlooking something.
Saved me a lot of time!
I had a problem like this in my website, and after a day trying some solution, I found this…
i had a problem like this, but, was setting innerHTML inside a <a> element, and no tags left opened, but still get this error.
Ive just figured out that IE re-validates the whole parent html, ie:
Will throw the error because the tag cant parent a tag, but i dont even touch it.
Just adding, lookup for your whole html, dont lay your eyes in the changing tag.
hi buddys, may this help someone.
dont ever place nested divs in between the form tags to play with there contents .. 🙂
I NEED the form tag….. what can I do ????? o.O
This doesn’t mean you have to remove all form tags. It means you have TWO form tags, one inside of the other, and you need to get rid of ONE of them.
My problem was [tags that aren’t nested properly]
Thank you so much……God Bless you.. I lost my valuable 2 hrs to fix..
This has also been driving me crazy. I thought the broblem is so exotic that I wouldnt be able to find anything about it online. Should’ve looked earlier!
In my case, the runtime error was thrown every time new ajax content included an A tag. I swear there was nothing invalid going on, A within A or anything. But the A tag broke it.
Go to h**l Microsoft. Web programmers should form an alliance and have an MSIE blackout day web wide =o).
Thanks a lot.
My problem was also the nested tags.
Lookup for your whole html, dont focus on the changing tag only.
Hi all i had a problem like this means facebook buttons are not appearing in Firefox,IE and Opera.but i can see only in chrome.Can u please suggestany resolution to fix that. i have checked my code and replaced div tag.but still these are not uploaded
Make sure you don’t have nested form tags. I use facebook buttons on my websites and it’s never caused a problem for me so you probably have a nested form tag somewhere.
i have problem,if i select variants of my product facebook buttons are disappeared
and if i select variants and click add to cart then the facebook buttons are again appeared
and facebook js is developed from this document http://www.hyperarts.com/blog/tutorial-how-to-add-facebook-share-button-to-your-web-site-pages/
i have enable.tpl(for facebook buttons ) and selectbox.tpl(for variant dropdown ).can u please help me how to fix this.
Why are you using ajax to re-load so much of the page? That’s the problem. You should set an ID or a class on the sections you want to re-load and leave the social div untouched. Every time you’re doing an ajax call the facebook buttons aren’t smart enough to initialize again. You could also try re-initializing them manually after the ajax call returns a response.
cheers saved me a lot of time
I have a checkbox, whose id im not bale to get using innerHTML fter 1st postback…. When the page loads it has value as [objectHTMLInputElement] but when it is post back, the value becomes [object] & i get error as microsoft jscript runtime error unknown runtime error innerhtml……
I do not have any nested form tags…plz suggest suitable solution
Make sure you don’t have any nested form tags and that you have a closing tag for all of your tags inside of your form tags.
Thank you SO much!! I just removed the tags from my page and it worked! =D