2017-04-02 12 views
0

アラートボックスをSweet Alert2(https://sweetalert2.github.io/)に変更したいと思います。 「アラートの確認」ウィンドウで「OK」ボタンをクリックすると、何も起きていないようです。私は何が間違っているのか、問題の解決方法を理解できないようです。次のように私のコードは次のとおりです。javascript sweetalert2の確認ボックスをtrueに戻す方法

HTML:

<a href="functionalities/removeIncoming.php?incId=<?php echo $incID; ?>"> 
<button type="button" class="btn btn-default" id="delBtn" onclick="validateRemove(event);"> 
<span class="glyphicon glyphicon-book" aria-hidden="true"></span> 
</button> 
</a> 

Javascriptを:

function validateRemove(e) { 
    e.preventDefault(); 
    swal({ 
    title: "Are you sure you want to archive this entry?", 
    type: 'warning', 
    showCancelButton: true, 
    confirmButtonColor: '#3085d6', 
    cancelButtonColor: '#d33', 
    confirmButtonText: 'Yes', 
    cancelButtonText: "No" 
}).then(function() { 
    swal(
    'Archived', 
    'Your file has been Archived.', 
    'success' 
) 
}) 
} 

答えて

2

のonclick = "CONFIRM1();"

関数CONFIRM1(){

swal({ 
     title: 'Are you sure?', 
     text: "You won't be able to revert this!", 
     type: 'warning', 
     showCancelButton: true, 
     confirmButtonColor: '#3085d6', 
     cancelButtonColor: '#d33', 
     confirmButtonText: 'Yes, delete it!', 
     cancelButtonText: 'No, cancel!', 
     confirmButtonClass: 'btn btn-success', 
     cancelButtonClass: 'btn btn-danger', 
     buttonsStyling: false 
    }).then(function() { 
     swal(
      'Deleted!', 
      'Your file has been deleted.', 
      'success' 
     ) 
     //success method 
    }, function (dismiss) { 
     // dismiss can be 'cancel', 'overlay', 
     // 'close', and 'timer' 
     if (dismiss === 'cancel') { 
      swal(
       'Cancelled', 
       'Your imaginary file is safe :)', 
       'error' 
      )     
     } 
    })  
} 
関連する問題