模态中未保存的信息会提示用户在退出模态之前进行保存
unsaved information inside modal prompts user to save before exiting the modal
我有一个模态。
我想用一种方式编写它,当用户点击取消或"转义"时,在文本框中输入任何信息时,它会提示他们保存未保存的信息。
我还需要弄清楚如何默认"添加/编辑高管信息"按钮,我使用的方法是:$(this).closest('.ui dialog').find('.ui对话框按钮窗格按钮:eq(0)').focus();以聚焦按钮,但当用户在文本框内单击,然后在文本框外单击时,它会取消聚焦按钮。
function ShowAddEditExecutive() {
$("#addEditExecutive").dialog({
modal: true,
width: 800,
appendTo: "form",
open: function () {
$(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:eq(0)').focus();
$(this).dialog("widget").find(".ui-dialog-titlebar").show();
// Removes the do you want to leave this page dialog.
window.onbeforeunload = null;
// The two isplalines below are 2 different ways to ensure the
// background is completely grayed out if the modal is larger
// then the page. The first was chosen so that the scroll
// bars are not disabled.
$('.ui-widget-overlay').css('position', 'fixed');
//$('body').css('overflow', 'hidden');
},
buttons: {
"Add/Edit Executive Information": function () {
$("[id*=btnAddEditExecutive]").click();
},
"Cancel": function () {
if (confirm("Are you sure you want to cancel ?")) {
//code if yes
$(this).dialog("close");
}
}
},
close: function (ev, ui) {
// Ensures when you cancel that the values are not retained.
$(this).remove();
// The two lines below are 2 different ways to ensure the
// background is completely grayed out if the modal is larger
// then the page. The first was chosen so that the scroll
// bars are not disabled.
$('.ui-widget-overlay').css('position', 'absolute');
//$('body').css('overflow', 'inline');
},
});
}
使用prompt()求解;Jquery命令
相关文章:
- 我想使用模态通过php文件发送邮件,并且我希望在提交关闭后关闭pop
- 打开一个模态并将其链接到AngularJS中的指令
- SemanticUI模态not onDeny/onApprove事件未激发
- 有没有比在app.js上绑定模块名称更好的方法来动态加载视图模型和视图以显示模态
- 如何通过所选索引(AngularJS)在模态弹出窗口中显示数据
- 包含数据库中相关信息的开放模态
- bootstrap消除模态并显示另一个模态
- 模态提示-如何重写此代码
- 模态框无法正常工作
- 将数据传递给由服务创建的Ionic模态
- iframe模态无法关闭
- 点击AngularJS模态窗口捕捉背景事件
- jQuery 模态表单保存到 JavaScript 数组
- 从 yii2 活动表单(在模态中)保存数据后无法显示成功消息
- 在带有模态窗口实例的 Angular JS 中保存和下一步
- 模态中未保存的信息会提示用户在退出模态之前进行保存
- 如何在模态窗口中保存表单值
- JQuery UI模态表单对话框保存数据到数据库
- 如何检查和传递变量,如果保存按钮在模态点击?javascript
- 在不重新加载页面的情况下保存模态中的数据