Check event.originalEvent or event.originalEvent.target inside the close
callback. You'll be able to see whether it was a mouse or keyboard event,
which element was keydowned or clicked, or whether it was close
programmatically. Another way it could close is the ESC key. That would show
as event.originalEvent.type == 'keydown' with the target being the dialog
element, .ui-dialog.

$("#dialog").dialog({
  buttons: {
    "Close": function() { $(this).dialog("close"); }
  },
  close: function(event, ui) {
    console.log(event.originalEvent.type, event.originalEvent.target);
  }
});

- Richard

On Thu, Mar 26, 2009 at 2:35 PM, Josh Powell <[email protected]> wrote:

>
> I want to initiate one closing action if the user clicks a cancel
> button or the 'X' and another when it is closed programmatically.  I
> can easily do this with the cancel button, but am not sure how to
> override the 'X' action and if I put it in the 'close' event for the
> dialog it always executes even when using javascript to close it.  Any
> advice would be appreciated, thanks!
>
> Josh Powell
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to