Add a confirmation alert before submitting a form

Instead of alert, you have to use confirm and return in your form, for an example:

<form 
    method="post"
    onSubmit="return confirm('Are you sure you wish to delete?');">
...
</form>

on your form can you try with a js function like:

<form onsubmit="return submitResult();">

and on your function have something like?

function submitResult() {
   if ( confirm("Are you sure you wish to delete?") == false ) {
      return false ;
   } else {
      return true ;
   }
}

I think this will be a good start.

Tags:

Forms

Alert