我使用JavaScript警告庫sweetalertsweetalert:通過論證如何回調
我的代碼是:
function foo(id) {
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
}
如何傳遞id
從foo()
功能SwaI位回調函數?
爲什麼被傳遞給它的'函數(ID){'?你可以直接訪問'MyId' – ozil
你的'小提琴'不工作太 – ozil
在內部函數(ID){這裏沒有需要的ID,所以我刪除了,並且還糾正了小提琴的URL –