I am new to alertify.js. What I am trying to do is, when the user cicks on a link, the browser should show confirmation box. If the user clicks of then go to the next page. If the user clicks cancel then stay on the same page. Is it possible to do this using alertify.js?
Here is my HTML code.
<a href="index.php" class="alert">Logout</a>
Here is my JavaScript code.
$(".alert").on('click', function(){
alertify.confirm("Are you sure?", function (e) {
if (e) {
return true;
} else {
return false;
}
});
});
But the problem is that whenever I click on the link, I go to the index.php page before clicking on the confirm.