2017-04-02 1 views
0

Ich möchte meine Alarmbox in Sweet Alert2 ändern (https://sweetalert2.github.io/). Nach dem Klicken auf die Schaltfläche "OK" im Fenster Alarm bestätigen scheint nichts zu passieren. Ich kann nicht herausfinden, was falsch ist oder wie ich das Problem lösen kann. meine Codes sind wie folgt:Wie Sie das Bestätigungsfeld für javascript sweetalert2 als wahr ausgeben lassen

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' 
) 
}) 
} 

Antwort

2

Onclick = "bestätigen1();"

Funktion bestätigen1() {

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' 
      )     
     } 
    })  
} 
Verwandte Themen