Confirmations or modals are one of the best approaches to get the attention of the user. In fact, they are useful not just for getting their attention but we can go ahead and block their interaction with the website until they acknowledge the modal itself.

Any modern web application should use modal to inform users about important information. However, it’s hard to convince web developers to use modals or notifications. Most of them still think that they are for mobile platforms.

Alerts and Notifications

Modals are a part of alerts though you might think they are a part of notifications. There’s a small difference between alerts and notifications. So, you need to understand when to use alerts and when to use notifications.

Alerts are used when something important happened and you need to ensure that the user acknowledges that. You can move further by getting a piece of information from the user when the modal or the alert pops up.

For notifications, one can think of them as a thing that happened, but it’s not important enough to block the user until they interact with it.

Native Modals in HTML

Using a modal wasn’t an easy thing to do in HTML. It required a lot of work — from building the structure with HTML to styling it with CSS and controlling its behavior with JavaScript.

Many libraries and frameworks introduced some handy ways to use modals in web applications, for example, Bootstrap.

#javascript #web-development #html #programming #html

Native Modals in HTML with Example
1.20 GEEK