How to show a div when loading the page

4

I currently have a hidden div

 <div id="llave" style="display: none">
   //aca esta el contenido
 </div>

but what I'm looking for is that when I finish loading the page it shows up.

I was trying like this:

<script type="text/javascript">
 $(window).load(function() {
 document.getElementById('llave').style.display='block';
 });
</script>

but it does not turn out ... will there be any way that it could happen?

    
asked by Kevincs7 27.08.2018 в 19:59
source

2 answers

1

I see you are using jQuery. In that case you can use $(document).ready() and .show() . It would stay like this:

$(document).ready(function() {
  $('#llave').show();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="llave" style="display: none">
   //aca esta el contenido
</div>
    
answered by 27.08.2018 / 20:03
source
0

Use jquery.

<script type="text/javascript">
    $( document ).ready(function() {
        $("#llave").show();
    });
</script>
    
answered by 27.08.2018 в 20:04