How to do not close Dialog of jQuery UI?

html, javascript, jquery, jquery-ui

Solution

You can add the `beforeClose` option to your dialog and return false on it:

$("#dialog").dialog({
   beforeClose: function(){
     return false;
   }
});

Demo: http://jsfiddle.net/UfpHz/9/

Problem

``` var error = 1; $(document).on('click', '.ui-icon-closethick', function(event){ if(error == 1){ alert('error'); event.preventDefault(); event.stopPropagation(); return false; } }) ``` How to do not close Dialog of jQuery UI? Now if i click on close button (x) then i have alert error, but dialog is closing. LIVE DEMO

Original source

Related problems