How to Create a Bootstrap Dismissible Alert ?
Bootstrap is a free and open-source tool for making responsive and beautiful web pages very easily. Alerts are used to notify the users and the visitors of the webpage about some action or information. Also, we can provide the user with dismissing the alert. But Simple alerts are not so good-looking. So with the help of Bootstrap, we can make really good Alerts inside the content of the webpage, that is inline Alerts and later we will learn how to dismiss them.
<link rel=”stylesheet” href=”https://email@example.com/dist/css/bootstrap.min.css”>
<script src=”https://code.jquery.com/jquery-3.6.0.slim.js”> </script>
The ".alert('close')" is a bootstrap function.
Example 2: In this example, we will use a button and the code is as follows. Here the button should of type=”button” and the class=”close”. We have placed the button inside the div container so that the button will look with the alert and the button is removed as the Alert is dismissed. Here the important thing is the data-dismiss=”alert” because otherwise, it won’t work. When we click the button, the same function is called by bootstrap only that we called in the first example to hide the alert.