Posted By

sevennbsp on 05/21/10


Tagged

confirm delete jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

legacye


jQuery universal delete confirm "are you sure" box


 / Published in: jQuery
 

  1. $('.delete').click(function (){
  2. var answer = confirm("Are you sure?");
  3. if (answer) {
  4. return true;
  5. }else{
  6. return false;
  7. }
  8. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: sevennbsp on May 21, 2010

this will pop up a confirm anytime you add a "delete" class to a button, div, or anything else. jQuery then returns true or false, making the form cancel or submit. Best if used on the submit button on the page.

You need to login to post a comment.