Is it necessary to display a confirmation message asking "Are you sure ..."? I have implemented the message, but the function return false;
is not working when the user clicks NO.
<script>
function confirmDelete(){
var answer = confirm("Are you sure you want to delete?");
if (answer){
// Do something if YES is clicked
}
else{
return false;
}
}
</script>
I am invoking the function using onclick attribute here
echo '<td><a onclick="confirmDelete()" href="delete-car.php?id='.$data["Car_ID"].'" class="ico del">Delete</a><a href="edit-car.php?id='.$data["Car_ID"].'" class="ico edit">Edit</a></td>';