views:

2310

answers:

1

What would be the preferred way of hiding an element before the page is rendered? $(document).ready() works just fine for firefox, but sometimes (connection to the server seems to be a major issue in this) it lags a little behind in internet explorer; the element is shown, and hidden shortly after wards. That is: the page is rendered before code in $(document).ready() is executed.

Now I've been looking through previously asked questions on SO about similar issues, but these are reported to be solved in 1.3.1. I am however, using jQuery 1.3.2 and experiencing this behavior (in IE6, IE7 and IE8).

One possible option would be to hide it by default through css, but this would make showing it dependent of having javascript enabled. I'm not willing to do that just yet.

I have also tried to move my javascript just above the /body tag, which doesn't seem to help either.

+6  A: 

Wow, this is going to be a quick one...

This document shows exactly what I was looking for, I hope it'll help someone some day :)

Daniel
Awesome answer, ta
TFD