javascript confirm result value sweetalert code example
Example 1: sweetalert confirm box
swal({ title: "Are you sure?", text: "Once deleted, you will not be able to recover this imaginary file!", icon: "warning", buttons: true, dangerMode: true,}).then((willDelete) => { if (willDelete) { swal("Poof! Your imaginary file has been deleted!", { icon: "success", }); } else { swal("Your imaginary file is safe!"); }});
Example 2: confirm sweet alert
swal("Are you sure?", { dangerMode: true, buttons: true,});