Div appears and disappears

2

I created a div where it has 2 links, when the page loads, both links are hidden and when I click "fetch" they should appear. The detail, problem is that they appear and disappear! Why might this be happening?

Follow the code:

<input type="submit" name="buscar" id="busca" value="Buscar">

$(document).ready (function(){
    $("#gerar").hide();

    $("#busca").click(function(){
        $("#gerar").show();
    });

});
    
asked by anonymous 24.10.2014 / 14:35

1 answer

3

This is called FOUC , flash of unstyled content . This means that the browser shows the content and only later sees / reads the script that hides it, causing a momentary flash. And the user temporarily sees this content.

The solution, and the correct way to do it is to use CSS so the content is not visible when the page loads, via CSS. Inline or CSS file.

You should use:

<div id="gerar" style="display: none;">...conteudo...</div>

or in CSS:

#gerar{display: none;} 
    
24.10.2014 / 14:39