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


Public

Tested

My Own Work
< ! --
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 4335 Downloads 1382

JS+JQuery UI
ANmarAmdeen
806
Revisions

v5.0