How to Set a Wait Time to Code in jQuery
There are times when you will want to have something happen after X amount of seconds. To do this you would use:
window.setTimeout(function(){
// Code here
}, 5000 ); // 5 seconds
The 5000 is in milliseconds, so this would happen after 5 seconds. Unlike the setInterval function, setTimeout occurs once.