DEV Community

Diego
Diego

Posted on

Enhace your javascript Alerts with SweetAlert!

Do you want to improve the alerts of your web application?

Tired of the look of default alerts?

So, today you are in luck!

You can use SweetAlert, which is a gorgeous replacement for alerts and error messages:

https://sweetalert.js.org/

It's is very simple to use. One you've included the css and js files in your source code, you just have to replace the "alert" function with the "swal" function.

alert("Oops, something went wrong!")
Enter fullscreen mode Exit fullscreen mode

Image description

swal("Oops", "Something went wrong!", "error")
Enter fullscreen mode Exit fullscreen mode

Image description

You have plenty of options to customize your alerts, so, let's dive into their docs, and, master it!

https://sweetalert.js.org/docs/

Happy coding!

Top comments (0)