jquery清理旧对话框 [英] jquery clean old dialog

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

问题描述

我正在尝试使用 UI 对话框来创建模式对话框.

I am trying to use UI dialog to create a modal dialog.

对话框工作正常,一切正常.我使用角落的X"关闭对话框.我尝试使用 dialog('destroy').remove();,但是我当然无法再次打开它.

The dialog workscorrectly, and all is well. I close the dialog using the "X" in the corner. I tried using dialog('destroy').remove();, but then of course I can't open it again.

我想我只是不明白如何重新初始化对话框并且其中没有旧值.

I think I just don't understand how to reinitialize the dialog and do not have the old values in it.

    function CreateWorkBoard()
{
    var jsmarty = WMCreateSmartyObject();
    var param =
    {
        MY_NAME1:GLOBAL_MY_NAME1,
        MY_NAME2:GLOBAL_MY_NAME2,
        LANG_NAME:LANGUAGE_NAME,
        BOARD_DIALOG_TITLE:WM_LANG_BOARD_DIALOG_BOARD_DIALOG_TITLE,
        BOARD_TITLE: WM_LANG_BOARD_DIALOG_BOARD_TITLE,
        COMMENT_TITLE:WM_LANG_BOARD_DIALOG_COMMENT_TITLE,
        MEMBERS_TITLE:WM_LANG_BOARD_DIALOG_MEMBERS_TITLE,
        CANCEL_BUTTON:WM_LANG_BOARD_DIALOG_CANCEL_BUTTON,
        REGISTER_BUTTON:WM_LANG_BOARD_DIALOG_REGISTER_BUTTON

    };
    jsmarty.assign('LANG', param);
    var divValue = WMSmartyFetch(jsmarty, 'createBoardDialog.tpl');
    document.getElementById('CREATE_DIALOG').innerHTML = divValue;
    jsmarty.clear_all_assign();
    //alert(document.getElementById('CREATE_DIALOG').innerHTML);
    //alert(divValue);

    //$.ui.dialog.defaults.bgiframe = true;
    //alert(document.getElementById('New_WorkBoard_Dialog').innerHTML);
    $('#New_WorkBoard_Dialog').dialog({

        autoOpen: false,
        height: 530,
        width:300,
        modal: true,
        resizable:false,
        buttons: {
            Cancel: function() {
                $(this).dialog('close');
                 //$('#New_WorkBoard_Dialog').dialog('destroy');
            },
            'Register board': function() {
                var board_name=document.getElementById("name");
                var comments=document.getElementById("comment");
                Createboard(board_name,comments);
                $(this).dialog('close');

            }

        },
        close: function() {

        }
    });
    $('#New_WorkBoard_Dialog').dialog('open');

}

推荐答案

正如Ra Yell所说,最好在关闭之前清理它,这样你再次打开对话框时就不必担心它了.

As Ra Yell said, is better to clean it before closing it, this way you don't have to worry about it when you open the dialog again.

$('input').val('');

上一条指令对我有用.

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

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