I solved it by adding the attribute data-confirmed
to the clicked element if the user confirms and then triggering a second click()
on the original element.
$.fn.customConfirm = function (message){
var handle = $(this);
// Create modal
// then ...
$(confirmModal).find("modal-footer a").click(function(e2){
e2.preventDefault();
$(handle).attr("data-confirmed", ($(this).hasClass("dialogConfirm")))[0].click();
return false;
});
};
$("a[data-confirm]").click(function(e){
if ($(this).attr("data-confirmed") !== "true")
{
e.preventDefault();
$(this).customConfirm();
return false;
}
$(this).removeAttr("data-confirmed");
// Continue
});