confirm delete button work, If the user selects ‘Ok
‘ then href redirect to ” url_to_delete “, else if ‘Cancel
‘ is clicked nothing happens.
Method 1
The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button.
<a href="url_to_delete" onclick="return confirm('Are you sure you want to delete this item?');">Delete</a>
Method 2
create a button with a function name ” ConfirmDelete “.
<input type="button" onclick="ConfirmDelete()">
Javascript
Here we simply show a confirmation box to delete if the user selects “ok” then returns true otherwise returns false.
function ConfirmDelete()
{
var x = confirm("Are you sure you want to delete?");
if (x)
return true;
else
return false;
}
I hope, it will help you.

Brijpal Sharma is a web developer with a passion for writing tech tutorials. Learn JavaScript and other web development technology.