javascript alert prevent sweetalert to start first code example Example: sweetalert close on custom button click swal.close()