Jquery Dialog - 初始化后div消失

标签 jquery modal-dialog jquery-ui-dialog

JQuery Dialog 最近给我带来了很多痛苦。
我有以下想要弹出的 div。 (忽略类在语法中不显示双引号)

TABLE class=widget-title-table border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
    <TD class=widget-title><SPAN class=widget-title>Basic Info</SPAN></TD>
    <TD class=widget-action>
    <DIV id=edit-actions jQuery1266325647362="3">
        <UL class="linkbutton-menu read-mode">
            <LI class="control-actions">
                <A id="action-button" class="mouse-over-pointer linkbutton">Delete this                 stakeholder</A> 
            <DIV id="confirmation" class="confirmation-dialog title=Confirmation">
                Are you sure you want to delete this stakeholder? 
            </DIV>

</LI></UL></DIV></TD></TR></TBODY></TABLE>

这个 JQuery 是......
$(document).ready(function() {

$('#confirmation').dialog({
    bgiframe: true, modal: true, autoOpen: false, closeOnEscape: false,
    draggable: true, position: 'center', resizable: false, width: 400, height: 150
    });

});

并且对话框被“打开”
var confirmationBox = $('#confirmation',actionContent);
if (confirmationBox.length > 0) {


    //Confirmation Needed
    $(confirmationBox).dialog('option', 'buttons', {
        'No': function() {
            $(this).dialog('close');
        },
        'Yes': function() {
            $('ul.read-mode').hide();
            $.post(requestUrl, {}, ActionCallback(context[0], renderFormUrl), 'json');
            $(this).dialog('close');
        }            
    });

    $(confirmationBox).dialog('open');

}

问题始于初始化本身。
当文档加载时,<div #confirmation>从标记中删除!
我之前遇到过类似的问题,但我不能在这里使用该解决方案。
在这个页面上,我可以有多个 PopUp div。

当我在打开它之前添加初始化时;表格弹出。但是在我关闭它之后,div 被删除了;所以我无法再次看到弹出窗口。

最佳答案

您看到它删除 #confirmation 的原因是因为 $("#foo").dialog()将#foo 从 DOM 中的任何位置移动到文档底部的包装元素内,这些元素创建最初隐藏的对话框样式。据了解,对话框在打开之前是隐藏的。

关于Jquery Dialog - 初始化后div消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2272961/

相关文章:

javascript - 简单的jQuery幻灯片在幻灯片之间过渡

javascript - 选择单选按钮时更改隐藏的输入字段值

javascript - 如何使用jQuery向我的网站添加 slider 过渡?

iPhone 模态视图比屏幕小

javascript - 替代 jquery ui

javascript - 如何在Woocommerce中为变体选项强制“选择”属性?

javascript - 显示 Bootstrap 模式时链接的 JavaScript 不起作用

jquery - 在open方法中更改jQueryUI对话框按钮文本

jquery-ui - 将 jquery ui 对话框与 knockoutjs 集成

jQuery UI对话框缓慢