I looked at the source SimpleModalfor you, and what you want to do cannot be done with their code. That's why:
Before calling your custom callback, onCloseit calls the following:
s.unbindEvents();
Which effectively says: "This check box closes whether you like it or not." This is not like a regular callback that you can cancel.
I would recommend using jQuery UI Dialog instead , which you should find is super easy to implement this functionality using their beforeclosecallback. You just use:
beforeclose: function(){
return confirm('Are you sure you want to close without saving?')
}
source
share