setTimeout() not executing
Posted
by Ben Shelock
on Stack Overflow
See other posts from Stack Overflow
or by Ben Shelock
Published on 2010-03-29T15:59:26Z
Indexed on
2010/03/29
16:03 UTC
Read the original article
Hit count: 461
I've got this simple function which displays a message to the user. If I add the timeout parameter it will slide back up automatically if not the user has to click it to get rid. But the timeout bit isn't working.
function feedback(text, timeout){
$('#feedback').text(text).slideDown('fast');
$('#feedback').click(function(){
$(this).slideUp();
});
if(timeout){
setTimeout(function(){
$('#feedback').slideup();
}, timeout);
}
}
© Stack Overflow or respective owner