我有引導程序模式。當它關閉時,會執行一些指令。但是現在我想問一下用戶是否真的想要關閉它(帶有確認窗口)我該怎麼辦? 這是我目前的代碼。 $('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
我想從用戶那裏獲得確認信息,以便在頁面關閉前用confirm()javascript函數保存表單。如果用戶按Ok按鈕,運行保存表單動作,如果按下取消按鈕,然後關閉頁面。 對於我這樣寫: window.onbeforeunload = function() {
if (confirm('Are you want to save Form ?')){
//saveActions