Don't auto-close dialog onClick
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.
精彩评论