Provide callback for show ()
$('#error').delay(800).show(0, function () {
setTimeout(function () {
location.href = '/profile'
}, 8000);
});
.show () documentation http://api.jquery.com/show/
The "show" will occur in 800 milliseconds, after the element is shown, the redirection will occur in 8 seconds. With this code you will have 2 "delays", so to speak.
Mark source
share