开发者

How can I change the buttons OR function of available buttons on a jQuery dialog window after it has been loaded?

So I am opening a

$('#someelement').dialog({ title.......
                           autoOpen: false,
                           //......

                           buttons: { OK: function() {
                                   $(this).dialog('close');}
                           },
                           //....
                         });

During this time a timer is running, if the user clicks "OK" I don't want anything to occur, but if the timer has run down, I would like change the function. I have tried the following unsuccessfully:

jQuery('#SessionTimeoutWarningDialog').dialog('option', 'buttons', {
                    'OK': function() {
                        RedirectToLogin;
                        jQuery(this).dialog('close');
                    }
                });

What am I doing 开发者_开发问答wrong, or how should I be handling this?


I guess I'll answer my own:

//........
$('#someelement').dialog('option', 'buttons', {
     'buttonName': function() {
          //your new functionality;
      }
 });

or with the beforeClose event:

$('#someelement').bind('dialogbeforeclose', function() {
      //your new functionality;
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜