Using Jquery to slowly hide a div
        Posted  
        
            by Pete Herbert Penito
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Pete Herbert Penito
        
        
        
        Published on 2010-06-09T20:44:58Z
        Indexed on 
            2010/06/09
            21:02 UTC
        
        
        Read the original article
        Hit count: 256
        
Hi everyone!
I'm trying to make some code which finds if a div exists, and if it does then have it fade away slowly. I have this to determine whether or not the div exists
    if($('#error').length != 0)
 {
  $('#error').hide(500);
 }  
And that does work but only on a refresh, I've been attempting to put it in a timer like this:
   var refreshId = setInterval(function()
   {
      if($('#error').length != 0)
 {
  $('#error').hide(500);
 }   
   }, 500);
But its not getting rid of the innerHTML! I have some code which on hover alters the innerHTML of the error div so I can fill it up, but for some reason this isn't working, any advice would help!
Thank you!
© Stack Overflow or respective owner