@Ken, your example worked fine for me ... almost. The only modification I had to do was unlink before setting the click function, because for some reason it would ignore the if statement and still close on first boot. Below is what I used to confirm when closing colorbox
$(".Add").colorbox({
onComplete:function(e){
$("#modalForm").ajaxForm(modalOptions);
$("#cboxClose").unbind();
$("#cboxClose").click(function(e){
e.stopPropagation();
if(confirm('Are you sure you want to cancel your changes?')){
$.colorbox.close();
$("#cboxClose").unbind();
}
});
}
});
Tommy source
share