Home > Archive by category 'Javascript code'
 

Alert message before delete

What we would like to do is have a confirmation box pop up when a user presses the “Delete” button and have a message along with 2 buttons on the box, “Ok” and “Cancel”.

This code can be used for this purpose.

1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript">
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
document.location = delUrl;
      }
}
</script>
1
2
3
4
5
<form>
<input onclick="return confirm('Are you sure you want to delete this record permanently?')" type="button" value="Permanently Delete" />
</form>

 
 
 

Categories

Tag