Articles

Javascript Confirm Delete Code

Ohh, You are a web developer? Looking for a pop up Javascript confirmation for your delete or Edit Icon in your code in PHP or JSP or so. Here is what i suggest.

Option 1:

<a href="deletepage.php?id=1" onclick="return confirm('Are you sure you want to delete?')">Delete</a>

Option 2:

<script>
function confirmDelete(dUrl) {
  if (confirm("Are you sure you want to delete")) {
    document.location = dUrl;
  }
}
</script>

<a href="javascript:confirmDelete('deletepage.php?id=1')">Delete</a>

I feel you would like to use the above one liner code 😉 It is best.

Connect on Skype or Google+
A.Niraj Kumar’s Present Address
Siva Nagar
Marripalem
Visakhapatanam
530018, (Vizag)
Andhra Pradesh, India
Photo of A.Niraj Kumar

Call New York (USA): +1-(646)-666-9606
Call London (UK): +44-020-3290-9606
Call India: +91-9492247412 (Mobile)