开发者

jQuery ui dialog removes div

开发者 https://www.devze.com 2023-01-19 16:17 出处:网络
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

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

example 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).dia开发者_高级运维log("close"); }
        }
    }).show();
}

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消