Share on facebook
Share on twitter

SweetAlert.js: A Prettier and More Flexible Alternative to alert(0)

Websites have become more comprehensive and complex applications over time. Website interactions are often confirmed with an alert. The browser’s standard warning suffices for most cases; however, it looks pretty terrible. With SweetAlert, you can easily create animated alerts that, additionally, provide more functions than the boring standard. Include SweetAlert and Get Started SweetAlert comes from the digital pen of the Stockholm-based developer Tristan Edwards whose homepage is, by the way, a good example for parallax scrolling. SweetAlert was released under the MIT license which means that it is totally free. It is made from a JavaScript and a CSS file and has no dependencies. Getting started is fairly easy: Apart from the JavaScript file, you need to include a style sheet file, which contains all alert styles, into the HTML document. Then you can call various alerts via “swal()”. swal(“Das hat schon mal geklappt.”); To create a simple alert dialogue box, all you need to do is titling the method with a text you want to have displayed. An OK button for closing/confirming the dialogue box will be added automatically. If you want additional text in the dialogue box, you need to add another parameter in the “swal()” call. […]