Why do you want to override $ .ui.dialog with the new close function when it has a closed event that you can connect to? Click on the events tab at the following link:
http://jqueryui.com/demos/dialog/#modal
Code examples from the page:
Set a callback function to handle the closing event as an init parameter.
$( ".selector" ).dialog({ close: function(event, ui) { ... } });
Bind to a close event by type: dialogclose.
$( ".selector" ).bind( "dialogclose", function(event, ui) { ... });
EDIT
To answer the question:
(function($){ var dialogExtensions ={ oldClose: $.ui.dialog.prototype.close, close: function(event){ this.oldClose(event);
source share