Oliver Jones Oliver Jones - 1 year ago 161
jQuery Question

JavaScript - Hide a Div at startup (load)

I have a div in my php page that uses jQuery to hide it once the page has loaded. But is there a way to hide it from the very start of loadup?

The reason I ask is because for a brief second, you can see the div when the page is loading, and then hides when the page is fully loaded.

It looks unprofessional.

Just wondering if there is a way around this?


Answer Source

Use css style to hide the div.

#selector { display: none; }

or Use it like below,


.hidden { display: none; }


<div id="blah" class="hidden"><!-- div content --></div>

and in jQuery

 $(function () {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download