So, the goal is to confirm switching to another UI tab using UI Dialog plugin.
Using common confirm method is simple:
jQuery("#tabsContainer").tabs({
select: function(event, ui) {
return confirm("Some confirmation message...");
}
});
but how to to achieve same behavior using Dialog modal box?
I think I have to call:
jQuery("#tabsContainer").tabs("select", ui.index);
on the “ok callback” but this is not working as I expected. Also – there are no errors being reported…
jQuery("#tabsContainer").tabs({
select: function(event, ui) {
jQuery("#dialogContainer").dialog({
buttons: {
'Ok': function() {
jQuery("#tabsContainer").tabs("select", ui.index);
},
Cancel: function() { return; }
}
});
return false;
}
});
The source of your problem is that
window.confirmis blocking and jQuery UI’s dialog is not. You can get around this by structuring your code differently. Here’s one of many possible approaches: