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

标签 javascript jquery html

您好,我正在使用 div 内容推送 jquery 对话框。第二次打开后,我想使用与 div 相同的内容刷新对话框,而不影响我的代码。我该怎么做?请帮助我..代码如下:

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代码:

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

最佳答案

我假设刷新你的意思是放回原始数据,我们在这里:

$(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;
    });
});

关于javascript - 如何刷新jquery对话框以供下次使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5938056/

相关文章:

Rails View 模板中的 html.haml 与 haml

php - 导航栏 Logo 下降且按钮未正确折叠

jquery - 可滚动的div,找到中间值的title

javascript - 使用 Pixastic 组合效果/滤镜

javascript - 复选框标签的总和值

javascript - 如何使用拼接删除数组中每个字符串的第一个字母?

javascript - jQuery 中的三元运算符未按预期工作

javascript - 如何检查数组是否包含javascript中的另一个数组

php - MySQL + PHP : HTML Style

javascript - ExtJS 4.1 从外部网页加载内容