How to hide a div after some time period?

rag picture rag · Mar 11, 2010 · Viewed 128.4k times · Source

I need to hide a div (like "mail sent successful" in Gmail) after a certain time period when I reload the page.

How can I do that?

Answer

rosscj2533 picture rosscj2533 · Mar 11, 2010

Here's a complete working example based on your testing. Compare it to what you have currently to figure out where you are going wrong.

<html> 
  <head> 
    <title>Untitled Document</title> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript"> 
      $(document).ready( function() {
        $('#deletesuccess').delay(1000).fadeOut();
      });
    </script>
  </head> 
  <body> 
    <div id=deletesuccess > hiiiiiiiiiii </div> 
  </body> 
</html>