![]() |
VOOZH | about |
Bootstrap 5 Alerts methods that are used to control the visibility of the alert component. For example, these methods can be used to close or dispose of an alert component. It is useful for displaying popup messages or user action notifications on a webpage.
alertElement.alert_method()Example 1: In this example, we will close an alert component using the "close" method given by the Bootstrap 5 alert object.
Output:
Example 2: In this example, we will dispose of the alert element using the "dispose" method given by the Bootstrap 5 alert object. Once we dispose of an alert element, we cannot use any methods given by the Bootstrap 5 alert object as it gets destroyed in the DOM.
Output:
Reference: https://getbootstrap.com/docs/5.0/components/alerts/#methods