How do I hide an HTML element before the page loads

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-06-01T15:30:10Z Indexed on 2010/06/01 15:33 UTC
Read the original article Hit count: 148

Filed under:
|
|

I have some JQuery code that shows or hides a div.

$("div#extraControls").show();   // OR .hide()

I initially want the div to be not visible so I used:

$(document).ready(function() {
    $("div#extraControls").hide();
});

However, on the browser, the content loads visible for a second before disappearing, which is not what I want.

How do I set the hide the element before the page loads whilst keeping the ability to show hide it dynamically with a script?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery