Close jQuery Dialog Box when clicked outside of the dialog popup
No Doubt, jQuery dialog box is one of the widely used UI components. It is not only easy to use but highly customize able and I have been using it a lot in my work. However, I came upon this issue once, the widget itself doesn't have an option to close the dialog box whenever user clicks anywhere outside the dialog box. There are other blogs out there, which uses their own custom method to close the box whenever clicked outside which is helpful but it didn't help me since I had already used dialog in many places (more than 20 time) and calling the custom method on every dialog initialization was not an option. So I came out with a way to make it dynamic and will work for all the dialog used in an application. Here is the final code: //extend jQuery Dialog widget. $.widget( "ui.dialog", $.ui.dialog, { // customize open method to register the click open: function() { var me = this; $(document).on('click',".ui-widget-overlay...