x This domain is for sale. If you intrested, Please contact : webspeckle@gmail.com

How to close jquery modal dialog when click outside?

If jquery ui dialog is a modal, then this code is working fine. If the dialog is not a modal you will find out another method.

.ui-widget-overlay is dialog overlay class. So attach an event handler function for this element.

Eg:
<script type="text/javascript">
$(document).ready(function()
{
        $("#dialog").dialog();
        $('body').on("click", ".ui-widget-overlay", function()
       {
            $("#dialog").dialog("close");
       });
});
</script>

No comments:

Post a Comment