SweetAlert2

下面是一个默认的浏览器弹出对话框和SweetAlert2对话框的比较效果。

浏览器内置的对话框

Code:
alert('Oops! Something went wrong!')

SweetAlert2

Code:
sweetAlert(
'Oops...',
'Something went wrong!',
'error'
)

Pretty cool huh? SweetAlert2 automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. It's even highly customizeable, as you can see below!

More examples

In these examples, we're using the shorthand function swal.

Modal Types

Input Types

Multiple inputs aren't supported, you can achieve them by using html and preConfirm parameters.
Notice that in preConfirm function you can pass the custom result to resolve():

适用浏览器:360、FireFox、Chrome、Opera、傲游、搜狗、世界之窗. 不支持Safari、IE8及以下浏览器。

来源:Gxl网-jquery插件