Skip to content

Instantly share code, notes, and snippets.

@skiz
Created July 8, 2011 19:46
Show Gist options
  • Select an option

  • Save skiz/1072655 to your computer and use it in GitHub Desktop.

Select an option

Save skiz/1072655 to your computer and use it in GitHub Desktop.

Revisions

  1. skiz created this gist Jul 8, 2011.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    $.fn.preventDoubleSubmit = function() {
    $(this).submit(function(event) {
    if ($(this).hasClass('submitted')){
    event.preventDefault();
    return false;
    }else{
    $(this).addClass('submitted');
    return true;
    }
    });
    };


    $('form').preventDoubleSubmit();