jQuery ui对话框删除div [英] jQuery ui dialog removes div

查看:75
本文介绍了jQuery ui对话框删除div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,并且第一个<td>中有一个隐藏的<div>.我想使用jQuery UI对话框显示div,我有以下代码

I have a table and within the first <td> is a hidden <div>. I want to show the div using a jQuery ui dialog which I have the following code

示例tr

<tr>
    <td>
        <div id="subscriberNote" style="display: none;">
            long message text........
        </div>
        long mess...
    </td>   
    <td>
        <a id="notedetails" href="#">View note</a>
    </td>
</tr>

jQuery

function subscriberNotes_onload() {

    $("#subscriber_notes tr").bind("click", function() {

        openDialog(this);

    });

}

function openDialog(row){
    $(row).closest("tr").find("td:eq(0)").find("#subscriberNote").dialog({
        title: "Message",
        modal: true,
        width: 600,
        height: 530,
        buttons: {
            "OK": function () { $(this).dialog("close"); }
        }
    }).show();
}

显示并关闭对话框后,它会删除隐藏的div,因此在刷新页面之前无任何显示.

After the dialog is shown and closed it is removing the hidden div and so has nothing to show until the page is refreshed.

推荐答案

使最后一个函数类似于:

Make the last function like:

function openDialog(row){
    $(row).closest("tr").find("td:eq(0)").find("#subscriberNote").dialog({
        title: "Message",
        modal: true,
        width: 600,
        height: 530,
        buttons: {
            "OK": function () { $(this).dialog("close"); }
        },
        close: function(){ $(this).dialog("destroy")}
    }).show();
}

根据文档,它应恢复为原始状态.

According to the docs it should revert to its original state.

这篇关于jQuery ui对话框删除div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆