Return to Snippet

Revision: 16373
at August 2, 2009 06:55 by dalexandre

Initial Code
$(document).ready(function() {
  $('form').submit(function() {
    if(typeof, "disabledOnSubmit") == 'undefined') {, "disabledOnSubmit", { submited: true });
      $('input[type=submit], input[type=button]', this).each(function() {
        $(this).attr("disabled", "disabled");
      return true;
      return false;

Initial URL

Initial Description
To prevent multiple submit from sending more than one request, 
bind the submit event and store a "disabledOnSubmit" data. Next time the event "submit" will be fire, the following jQuery code will return false. All submit buttons are also disabled (nice user feedback).

Initial Title
jQuery to prevent multiple submit on a form

Initial Tags
javascript, jquery

Initial Language