Alerts in our web app
In the last chapter, we did almost everything related to page components. Now we will create some components that interact with the user. To start this, we will introduce alerts, which are very common components of every web app.
In order to learn about alerts, we should create some of them. The pattern for creation is pretty simple; just remember to import Bootstrap JavaScript as we have been doing all throughout the book.
The main class needed to create alerts is .alert
. You can just follow this class with some other, regarding the type of alert, such as .alert-success
for a success message. There are other classes available as well, such as .alert-info
and .alert-danger
. Just replace the suffix of .alert
with the one that you want to use.
It's time to create our first alert! Keeping the same code of the web app from the last chapter, right before div#main
, you must have your ol.breadcrumb
. Replace ol.breadcrumb
with your .alert
, like what is shown in this screenshot...