Javascript Confirm Delete Prompt

Submitted by:Pitter Alderson

Date added:16 July, 2015

Category:JavaScript

Confirm a deletion (or any action) with Javascript.

Tags: delete prompt

Code Snippet:

<script type="text/JavaScript">

FUNCTION confirmDelete(){
VAR agree=CONFIRM("Are you sure you want to delete this file?");
IF(agree){
RETURN TRUE;
}ELSE{
RETURN FALSE;
}

}
</script>


<a href="somefile.php" onClick="confirmDelete();">Your Link</a>

OR

<form onSubmit="return confirmDelete();">
 
 

Comments