How to use confirm using sweet alert?

后端 未结 7 1891
萌比男神i
萌比男神i 2020-12-05 00:11

In this code form is submitted even i am clicking on no

document.querySelector(\'#from1\').onsubmit = function(){

 swal({
    title: \"Are you sure?\",
             


        
相关标签:
7条回答
  • 2020-12-05 01:00
    swal({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Confirm!'
    }).then(function(){
        alert("The confirm button was clicked");
    }).catch(function(reason){
        alert("The alert was dismissed by the user: "+reason);
    });
    
    0 讨论(0)
提交回复
热议问题