Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI dialog - how to make it not closable?

I'm trying to use the jQuery dialog as a loading screen for ajax. I have it working very well so far but I'd like the loading screen to be not closable. However it seems the UI dialog doesn't have "closable" as an option?

How do you make it non-closable? I tried setting closeText to blank but that didn't do anything. The little 'X' still shows up on the upper right corner.

Don't you think closable should be an option for the dialog widget?

Thanks

like image 661
Ying Avatar asked Jan 29 '10 17:01

Ying


2 Answers

Ying, just pass a callback function to beforeclose:

$("#loading").dialog({
  beforeclose: function(){ return false }
  // other options here
});
like image 88
Doug Neiner Avatar answered Sep 22 '22 02:09

Doug Neiner


Doug, thanks for the quick reply. That disabled close action. However, it did not hide the "X" on the upper right corner. I ended up using css to hide the "X".

/* hide the close x on loading screen */
.classForMyDialog .ui-dialog-titlebar-close {
    display: none;
}
like image 27
Ying Avatar answered Sep 18 '22 02:09

Ying