简体   繁体   English

如何刷新jquery对话框以供下次使用?

[英]How to refresh the jquery dialog for next use?

HI,I am using a div content to push in jquery dialog.After opening for the second time i want to refresh the dialog with the same content of div without affecting my code.How can i do that? 嗨,我正在使用div内容推入jquery对话框。第二次打开后,我想用相同的div内容刷新对话框而不影响我的代码。我怎么能这样做? Help me pls..The code is like: 帮帮我..代码如下:

Jquery dialog code: Jquery对话框代码:

$(function() {
    $( "#atendeePopup" ).dialog({
    autoOpen: false,
    width:610,
    height:680,
    show: "fold",
    hide: "core"
    });

    $('.flora.ui-dialog').css({position:"fixed"});

    $( "#widgetAtendeeIcon").click(function() {
        $( "#atendeePopup" ).dialog( "open" );
        return false;
    });
});

html code: HTML代码:

<div id=""#atendeePopup" >
<p>My div content here</>
</div>

First of all your HTML is invalid (maybe not copy & paste): 首先,您的HTML无效(可能不是复制和粘贴):

<div id="#atendeePopup" >
   <p>My div content here</p>
</div>

you can change the content of your popup by calling: 您可以通过调用以下命令更改弹出窗口的内容:

$("#atendeePopup").html("<p>This is the new content</p>");

I am assuming by refresh you mean put back in the original data, and here we gooo: 我假设refresh你的意思是放回原始数据,在这里我们gooo:

$(function () {
    if ($("#atendeePopup").data('orig') == undefined) {
        $("#atendeePopup").data('orig', $("#atendeePopup").html());
    }
    $("#atendeePopup").dialog({
        autoOpen: false,
        width: 610,
        height: 680,
        show: "fold",
        hide: "core"
    });
    $('.flora.ui-dialog').css({
        position: "fixed"
    });

    $("#widgetAtendeeIcon").click(function () {
        if ($("#atendeePopup").data('orig') != undefined) { //update to orig
            $("#atendeePopup").html($("#atendeePopup").data('orig'));
    }
    $("#atendeePopup").dialog("open");
    return false;
    });
});

It should be as easy as setting $(<div name> <input name>).val('') for each of the inputs in the form. 它应该像为表单中的每个$(<div name> <input name>).val('')设置$(<div name> <input name>).val('') If you include your code, we can give more specific advice. 如果您包含代码,我们可以提供更具体的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM