clock  Mon - Sun 8.00 AM - 8.00 PM
mail  edu@teknowize.com
fb
instagram
play store
pinterest

Delete Confirmation Message using JavaScript

  Hariom Prajapati
  23 Jun 2022
  JavaScript
Imperial Advance Hero Image

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>
<html>

<head>
    <title>How to Show Delete Confirmation Message using JavaScript</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>

<body>
    <img src="https://scontent.fpat3-3.fna.fbcdn.net/v/t1.6435-9/173435656_100553882178512_5067283647022573909_n.png?_nc_cat=106&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=YI-DPfxix60AX_04-6p&_nc_oc=AQm4t1zTSXcQOtWsECWg1b54FYG-yKvts0yit49eZyz7CE2XfRIVi4R4ohi89BeAmD8&tn=8lmRwSjEcX7Ytb8g&_nc_ht=scontent.fpat3-3.fna&oh=aeb0e2f0e59fb3efc1c038d45cb9ba6a&oe=61C06B91"
        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>
</body>

</html>

 

Output

javascript