Skip to content

Instantly share code, notes, and snippets.

@benschwarz
Created August 20, 2009 12:26
Show Gist options
  • Select an option

  • Save benschwarz/171038 to your computer and use it in GitHub Desktop.

Select an option

Save benschwarz/171038 to your computer and use it in GitHub Desktop.
$("form input[name=_method][value=delete]").parents("form").submit(function (event){
if(!confirm("Are you sure?")) {
event.preventDefault();
}
});
// Throw this into a rails-app with jquery present and it'll ask you before you delete something.
// I'd much rather implement a "delete, then offer undo" pattern, sometimes you have to go for the quick win though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment