开发者

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 t开发者_JS百科he same content of div without affecting my code.How can i do that? Help me pls..The code is like:

Jquery dialog code:

$(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:

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


I am assuming by refresh you mean put back in the original data, and here we 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;
    });
});


First of all your HTML is invalid (maybe not copy & paste):

<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>");


It should be as easy as setting $(<div name> <input name>).val('') for each of the inputs in the form. If you include your code, we can give more specific advice.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜