All modern web application uses alerts to show messages to the user. These alerts have a close button to close them or can be closed automatically using Twitter Bootstrap. In this post, we will create automatically closing of alerts using twitter Bootstrap.
Basic idea is to use jQuery setTimeout() method to close the alert after specified time.
Note: Delay is defined in milliseconds. 1 second is equal to 1000 milliseconds.
Example 1: In this example, alert is accessed in script using the id and then alert is closed after 5 seconds.
Example 2: In this example, alert is accessed in script using it’s class and alert closes after 2 seconds.
- Bootstrap 4 | Alerts
- Bootstrap (Part-7) | Alerts , Wells, Pagination and Pager
- How to use Bootstrap modal for YouTube videos and play automatically ?
- How to Check Twitter Bootstrap is Loaded or not ?
- How to automatically close all collapsible elements inside of the accordion when closing the accordion?
- How to use modal closing event in Twitter Bootstrap ?
- Data-toggle attributes in Twitter Bootstrap
- How to hide element on small devices in Twitter Bootstrap ?
- How to change the width and height of Twitter Bootstrap's tooltips?
- How to handle the modal closing event in Twitter Bootstrap?
- How to use complex HTML with twitter Bootstrap tooltip using jQuery ?
- Bootstrap 5 | Close button
- How to open or close react-bootstrap modal pro-grammatically?
- How to change the position of modal close button in bootstrap?
- Bootstrap | Close Icon for dismissing content with Examples
- How to scroll automatically to a particular element using JQuery?
- How to scroll automatically to the Bottom of the Page using jQuery?
- How to call a function automatically after waiting for some time using jQuery?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.