2011-04-25 215 views
2

jQuery的對話腳本隱藏jQuery模態窗口

function SupplierGridPopup() { 
    var dlg = $("#divSupplierGrid").dialog({ bgiframe: true, 
     width: $(document).width(), 
     height: $(document).height(), 
     modal: true, 
     focus: function() { hideScrollBars(); }, 
     open: function() { hideScrollBars(); }, 
     beforeClose: function() { showScrollBars(); } 
    }); 
    dlg.parent().appendTo(jQuery("form:first")); 
} 

如何隱藏一個jQuery模態對話框。因爲我已經將模態設置爲true,所以隱藏div(即div.hide())似乎不起作用。我試圖用$("#divSupplierGrid").dialog("option", "hide", 'slide');聲明隱藏。仍然不工作。如何隱藏div?

回答

3

$("#divSupplierGrid").dialog('close'); // HIDEs the dialog

$("#divSupplierGrid").dialog('destroy'); // Remove the dialog functionality completely.

0

嘗試

$("#divSupplierGrid").dialog('close'); 

關閉dialog..and這樣做,你將其隱藏