As I have already mentioned in my comment Boxy.confirm
is async unlike native confirm
. Your code will continue its execution without waiting for user to click OK or Cancel. That is why you need to perform the actual action inside confirm callback.
Consider the following code.
$('form .close').click(function(e){
var form = $(this).closest('form');
Boxy.confirm('Are you sure?', function() {
form.remove(); //remove it only if user confirmed.
});
form.append('<p>Close was clicked.</p>');
})
This code will append message every time user clicks close link. But the form will be actually removed only if user confirmed the action.
http://jsfiddle.net/tarabyte/972ak/4/