I want to have a confirmation before deleting an account. How can I do it?
This is the picture for the UI of the accounts.
This is the html code.
<a href="uses_script.php?user_id=<?php echo $row['id'];?>&username=<?php echo $_SESSION['user_username']; ?>"
id = "del"
data-toggle="tooltip"
data-placement="top"
title="Delete">
<i class="mdi mdi-close"></i></a>
This is the javascript.
const deleteIcon = document.querySelectorAll("del");
deleteIcon.addEventListener("click", (e) => {
const confirmVar = confirm("Do you want to proceed? ");
if (!confirmVar) e.preventDefault();
}
What I want to do is before deleting users I want to have a confirmation that when I click OK it will delete and when I click cancel it will just close.