confirmDelete

Asks user before running a link (mostly before deleting)
Small important part in any web app
Then if confirmed, it will add "Confirm=1" to the link

<!--
To use ...
<a href="/Delete/?ItemID=15588&C=CatID" onClick="return confirmDelete(this)"><i class="fa fa-trash fa-sm fa-fw text-danger"></i> Delete</a>

Alternatively, you can use an inline syntax
<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a>

-->

<script language="JavaScript" type="text/javascript">
 function confirmDelete(anchor) {
  if (confirm('Are you sure?')) {
   anchor.href += '&confirm=1';
   return true;
  }
  return false;
  }
</script>

Views 419 Downloads 149

'link', 'confirm', 'delete', 'are you sure?'

ANmarAmdeen
324
UI JS+JQuery
Revisions

v3.0