Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
155
rated 0 times [  158] [ 3]  / answers: 1 / hits: 16307  / 15 Years ago, wed, december 9, 2009, 12:00:00

Im using jquery for various things on my site, but one thing im not sure how to do, is have it show an element, then wait X seconds, and hide the element.



$('#form').ajaxForm(function() { 
$('#cartcontents').fadeOut(fast).load('cart.php').fadeIn(fast);
});


That's the JavaScript that I'm using now. How could I have it (when the form submits) display the div #notice for 5 seconds, then fadeOut?


More From » jquery

 Answers
4
$('#form').submit(function() {
$('#notice').show();
setTimeout(function() {
$('#notice').fadeOut();
}, 5000);
});

[#98115] Friday, December 4, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
loganl

Total Points: 424
Total Questions: 86
Total Answers: 112

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
;