How to Automatically Close Alerts using Twitter Bootstrap
Calling window.setTimeout(function, delay) will allow you to accomplish this. Here’s an example that will automatically close the alert 2 seconds (or 2000 milliseconds) after it is displayed. $(“.alert-message”).alert(); window.setTimeout(function() { $(“.alert-message”).alert(‘close’); }, 2000); If you want to wrap it in a nifty function you could do this. function createAutoClosingAlert(selector, delay) { var alert = $(selector).alert(); … Read more