开发者

JQuery Refresh the content of a UI dialog box?

I have problem when i tried to invoke multiple dialog boxes in a page. I have three anchor tags on clicking 3 tags i have to generate dialog boxes with diferent contents . But when i clicked the 2nd tag i am getting the same dialog box of the previous one? How can i refresh the content inside a dialog box?

What i have done is given below

$("a.delete").click(function (event) {
        DialogBox('#DeleteConfirm');
});

   $("a.message").click(function (event) {
            DialogBox('#DeleteConfirm');
    });

 var $dialog = null; function dialog() {
    // create dialog 开发者_JS百科if not done already
    if (!$dialog) {
        $dialog = $("#dialogToShow").dialog({
            title: "Confirm Password",
            closeText: "Cancel",
            show:"slide",
            resizable: false,
            modal: true,
            autoOpen: false, // this is important! prevent auto open
            open: function(ev, ui){
                $('.ui-widget-overlay').stop().animate({"opacity": "0.40"}, 1480);
            },
            close: function(ev, ui){
                $('.ui-widget-overlay').stop().animate({"opacity": "0"}, 1480);
            }                  
        });
    }
    // use the reference to the dialog and call open.
    $dialog.dialog('open');
    return false; }

Can anybody help me?


you have to create a separate dialog for each case then - and call them separately

if I understood you correctly, you should have done sth. like

$("a.delete").click(function (event) {
    dialog($('#DeleteDialog'), "Confirm Password");
);

$("a.message").click(function (event) {
        dialog($('#MessageDialog'), "Message");
});

function dialog(content, title) {
     $(content).dialog({
        title: title,
        closeText: "Cancel",
        show:"slide",
        resizable: false,
        modal: true,
        //autoOpen: false, // this is important! prevent auto open
        open: function(ev, ui){
            $('.ui-widget-overlay').stop().animate({"opacity": "0.40"}, 1480);
        },
        close: function(ev, ui){
            $('.ui-widget-overlay').stop().animate({"opacity": "0"}, 1480);
        }                  
    });
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜