The problem here is that you need to bind the event to . You are currently invoking .dialog()that opens a dialog box (if autoOpen: falsenot an option provided). This means that before it is executed .bind(....), this event has already occurred. The solution is to simply bind before the event occurs, for example:
container.bind('dialogopen', function(event, ui) {
if (someCondition) {
$(this).dialog('close');
}
}).dialog();
, , , , , .
, dialogopen , ( )... , , DOM, .