Today I have found out that Internet Explorer 9 might fire document ready JavaScript event before document is actually ready. It took me a few swearwords to figure it out. I experienced this issue using Internet Explorer 9 and jQuery 1.8.0.
The solution is simple – in case you are using inline scripts, just put them at the bottom of your page. That’s it.
A little more technical information
Problem occurred with linking jQuery like this just before </head>
tag:
<script type="text/javascript" src="./scripts/jquery-1.8.0.js"></script>
The error occured in the inline script tags within jQuery’s document.ready() event. HTML code of the page was a bit complicated and large. When I tried to create separate page just to reproduce this bug I did not succeed.