Show then delay and finally hide
Hi All,
I am trying to show a hidden div if a certain condition is met, then have there be a delay and then finally have the div hidden again. Here is what I got:
HTML:
<span id="category_message" style = "display: none;"><h3 style = "color: red;">Invalid Category</h3></span>
jQuery:
-
$j('#category_message').show(0); setTimeout(function(){
$J('#category_message').hide();
}, 2000);
I have also tried several variations of this and what happens is that the show works great, but the delay and the final hide never happen. What I originally thought was that maybe there was an error encountered and that code was never being executed, but after placing some alerts I discovered this wasn't the case.
I have also tried:
$('#category_message').show(0).delay(2000).hide(0);
setTimeout(function() {
$('#category_message').fadeOut();
}, 2000);
The result is always the same, the hidden div appears but never disappears after the delay. Any suggestions? Thanks,
-S