Confirm Box Before Delete Item using jquery – onlinecode

Confirm Box Before Delete Item using jquery – onlinecode

In this post we will give you information about Confirm Box Before Delete Item using jquery – onlinecode. Hear we will give you detail about Confirm Box Before Delete Item using jquery – onlinecode And how to use it also give you demo for it if it is necessary.

When we will click on delete recorded, after then will open the confirm box and will ask you, are you sure delete this record. that time this tutorial help you.

Here, we have simple create “users” table and then list all users with table using bootstrap. Using bootstrap it looks better layout. So added delete button, when user will click on delete button confirm box open and ask to remove or not current item. after click on yes fire ajax and remove the current record.

This is a way of ensuring that items are not accidentally deleted, or the wrong item deleted by mistake. When clicked on the link, then open the confirmation box. if the user selects ‘ok’ then delete is done. if the user selects on ‘no’ or ‘cancel’ then not delete records..

See below example

// first example for Confirm Box Before Delete Item using jquery

<a href="delete.php?delete_id=<?php echo $row['id'];?>"  onclick="return confirm('Are you sure you want to delete this item?');">Delete</a> 

// second example for Confirm Box Before Delete Item using jquery

<a href="delete.php?delete_id=<?php echo $row['id'];?>"  data-confirm="Are you sure to delete this item?">Delete</a>

$('.delete').on("click", function (e) {
    e.preventDefault();

    var choice = confirm($(this).attr('data-confirm'));

    if (choice) {
        window.location.href = $(this).attr('href');
    }
});
Please follow and like us:
Hope this code and post will helped you for implement Confirm Box Before Delete Item using jquery – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  33  =  34

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US