📜  javascript 在页面刷新未保存的更改时显示弹出窗口 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:38.502000             🧑  作者: Mango

代码示例1
var onReloadCheck = function () {
        $(window).on('beforeunload', function () {
            var modal = $('#myModal').hasClass('show');
            if (modal) {
                return "If you leave before saving, your changes will be lost.";
            }
        });
    }