c# - JQuery 模态对话框使用追加显示在叠加层后面

标签 c# jquery jquery-ui

我有一个包含一些东西的 div,我想弹出给用户,这样他们在提交之前必须同意:

<div id="terms" style="display:none">
        <p style="font-weight:bold">If your data is not backed up in advance, you may have to forfeit your booked slot and rebook the handover on another date.</p>
        <asp:CheckBox ID="cbTerms" ClientIDMode="Static" CssClass="error" Style="font-size:0.8em" Text =" I understand the above, and will ensure my data is backed up prior to the handover date" runat="server" /> 
        <p style="text-align:right"><asp:Button ID="btnSubmit" ClientIDMode="Static" runat="server" Text="Submit" OnClick="btnSubmit_Click" Enabled="False" /></p>
    </div>

我正在使用 jQuery UI 对话框来实现此目的:

    $('#terms').css('visibility','block');
    $('#terms').dialog({ 
           modal: true, 
           width: '500px', 
           title: 'IMPORTANT! Remember To Backup Your Laptop', 
           open: function (event, ui) { 
                 $('.ui-dialog-titlebar-close').hide(); 
                 $(this).parent().appendTo('form'); }, 
     });

如果我遗漏了:

$(this).parent().appendTo('form'); }

按钮不会触发,因为它已经在表单之外。

但是,当我将其放入以使按钮起作用时,表单出现在模态叠加层后面并且不可点击。

我正在使用母版页 - 不确定这是否相关。

最佳答案

我会改为将对话框添加到文档节点,并将事件处理程序添加到调用 form.submit() 的按钮。

关于c# - JQuery 模态对话框使用追加显示在叠加层后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17367420/

相关文章:

javascript - 创建同时悬停效果

javascript - 替换 keyup 上的值时重置 'input' 元素的光标位置

javascript - jQuery 用户界面。设置选项后加一

c# - 使用管理员权限运行部分 c# 程序

c# - 运行时反射类的属性获取/设置委托(delegate)

jquery - 如何将 KendoSlider 插入 Kendo Grid?

jquery后退按钮显示div元素

C# - DataGridView 无法添加行?

c# - 在类中实例化

javascript - 如何在 Angular 6 中使用 jquery-ui