sweetalert : 一個比較好看的彈出框


1.引入

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"> </script> 

2.三個常用的提示框

$(".demo_1").click(function() { 
    swal("這是一個信息提示框!"); 
}); 
$(".demo_2").click(function() { 
    swal("Good!", "彈出了一個操作成功的提示框", "success"); 
}); 
$(".demo_3").click(function() { 
    swal("OMG!", "彈出了一個錯誤提示框", "error"); 
});

3.警告框提示

swal({ 
    title: "您確定要刪除嗎?", 
    text: "您確定要刪除這條數據?", 
    type: "warning", 
    showCancelButton: true, 
    closeOnConfirm: false, 
    confirmButtonText: "是的,我要刪除", 
    confirmButtonColor: "#ec6c62" 
}, function() { 
    $.post(getUrl("Cart/del"), {id: id}, function(data) { 
        location.reload(); 
    }) 
});

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM