I'm trying to implement a confirmation dialog before deletion by using e.preventDefault() to prevent immediate deletion. However, I am facing an issue in the YES function where I would like to resume the click event's operation with return true while setting e.preventDefault() to false. How can I proceed to allow the click event to carry out its task?
<script type="text/javascript>
$(function() {
$('#delete_registry').on('click', function(e) {
e.preventDefault();
alertify.confirm('Delete Registry', 'Are you sure you want to delete your registry? All data will be lost.', function() {
console.log('Deleting information');
this.close();
return true;
}, function() {
this.close();
return false;
})
.setHeader(header)
.setting({
'closable': false,
'resizable': true,
'labels': {'ok': 'Yes', 'cancel': 'No'}
});
});
});
</script>