Search code examples
jqueryjquery-ui-dialogjquery-dialog

Dialog box hide() and show() -- Jquery?


Iam using 3 dialogs in my page for 3 diff purpose.

Iam creating dialog as

  $(".dialog").dialog({
        height: 238,
        width: 465,
        resizable: false,
        title: "Edit"
    });

After my action done on dialog iam closing dialog as

   $(".ui-dialog").hide();

When i hide this way dialog is not getting opening for 2nd time, So tried showing dialog starting of function like

  $(".ui-dialog").show();

My problem started here....

When i show dialog, Dialogs are getting opened multiple times, STill the first openined dialog is getting Overlapped wth the second dialog,

Is there any proper way to hide and Show dialog without overlapping or in clean way.


Solution

  • You need to use the close(hide) and open(show) functions provided by the widget

    $(".ui-dialog").dialog('close');
    $(".ui-dialog").dialog('open');