Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
After form submit, disable submit button.
jQuery(function($) {
// set data-after-submit-value on input:submit to disable button after submit
$(document).on('submit', 'form', function() {
var $form = $(this),
$form.find(':submit').each(function() {
$button = $(this);
label = $'after-submit-value');
if (typeof label != 'undefined') {
$button.val(label).prop('disabled', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment