开发者

Don't auto-close dialog onClick

开发者 https://www.devze.com 2022-12-13 01:45 出处:网络
How can I prevent the jQuery dialog from closing when I click the mouse? Closing on hitting esc is fine but I want to keep it open until I close it by clicking the close-icon.

How can I prevent the jQuery dialog from closing when I click the mouse? Closing on hitting esc is fine but I want to keep it open until I close it by clicking the close-icon.

Any idea开发者_开发问答s?


You can use the dialogbeforeclose event to pass a callback function that will be called whenever the dialog is about to close.

If you return false from this function, the close will be cancelled.

$('.selector').bind('dialogbeforeclose', function(event, ui) {
  ...
});

http://docs.jquery.com/UI/Dialog#event-beforeclose

You can do something like check the element that the event was fired from, and use that to determine whether or not the user clicked on the X to close or on something else.

0

精彩评论

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

关注公众号