Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to show div after some time period with jQuery?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.38k
    Comment on it

    Sometimes we need to display some alert or dive after some period on Web page.

    We can do this by using setTimeout method as below:

      <html> 
      <head> 
        <title>Demo to show div</title> 
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
        <script type="text/javascript"> 
          $(function(){
        setTimeout(function(){
            $("#alertMessage").show();
            }, 2000);
          });
        </script>
        <style>
        .hideMessage{display:none;}
       </style>
      </head> 
      <body> 
        <div id="alertMessage" class="hideMessage"> This is alert message. </div> 
      </body> 
      </html>
    

    Hope this will help you:)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: