How to Show Delete Confirmation Message using JavaScript


In this tutorial we will see how to show delete confirmation message using JavaScript. Delete confirmation message is always important because if you do not show any confirmation message before deleting then if user click on delete button by mistake then the data will directly delete. So, always show a confirmation message to user before deleting any data.

Here we will use JavaScript confirm() method to show confirmation message before delete .

<!DOCTYPE html>



  <title>How to Show Delete Confirmation Message using JavaScript</title>

  <script src=""></script>



<img src="" width="100">

<!-- delete confermation alert in html   -->

<a href="url_to_delete" onclick="return confirm('Are you sure you want to delete this item?');"><button>Delete image</button></a>    




Related Topics