How to extend JQuery UI plugin
The existing dialog plugin doesn’t have an option to close dialog on clicking modal overlay, how to add an option to provide the functionality? (function($){ var _init = $.ui.dialog.prototype._init; $.ui.dialog.prototype._init = function(){ var self = this; _init.apply(this,arguments); $(‘.ui-widget-overlay’).live(‘click’, function(){ if (self.options[‘overlay_close’]){ self.destroy(); } }); } })($);