submit snippets

How to prevent double form submissions with jQuery

Tagged ajax, submit, jquery  Languages javascript

This snippet will disable the submit button after the user clicks on it:

$('form').submit(function(){
    var $button = $('input[type=submit]', this);
    $button.attr('disabled', 'disabled');
    $button.attr('value', $button.attr('value') + "...");
});

For Ajax forms, you need to enable the button again in your code.