Remove object over time

2

Well, I have the following modal

<div id="alerta-imagem">
    As imagens de perfil precisam ter altura e largura proporcionais, com tamanho máximo de 200x200
</div>

I looked in google some ways, but I only found setTimeOut() and setInterval() , but I could not use them, I wanted to know both with javascript with both jquery , how do I, for example, after 10 seconds this mode earn a display:none

    
asked by anonymous 23.10.2016 / 03:22

1 answer

3

You can use setTimeout together with jquery hide, follow the example below:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="modal"> Testeeeeeee </div>

<script>
 
  setTimeout(function() {
    $('#modal').hide();  

  }, 3*1000); // 3 segundos
 
</script>
    
23.10.2016 / 03:37