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 >
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 4,544
Downloads 1,474
CodeID
DB ID
ANmarAmdeen
602
Revisions
v5.0
Wednesday
June
9
2021