Created
May 19, 2009 19:50
-
-
Save maccman/114347 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sold on jQuery - just re-wrote the following Prototype code: | |
Element.observe(window, 'load', function(){ | |
// This is for slow forms (like the signup one), | |
// so the user doesn't click 'Submit' twice. | |
$$('form.slow').each(function(frm){ | |
var sub = frm.down("input[type='submit']"); | |
if(sub) sub.disabled = ''; | |
$(frm).observe('submit', function(e){ | |
var sub = frm.down("input[type='submit']"); | |
if(sub){ | |
sub.disabled = 'disabled'; | |
sub.value = 'Working...'; | |
} | |
}); | |
}); | |
}); | |
// And now: | |
jQuery(function($){ | |
$("form.slow input[type='submit']").attr('disabled', ''); | |
$("form.slow").submit(function(){ | |
var sub = $(this).find("input[type='submit']"); | |
sub.attr('disabled', 'disabled'); | |
sub.val('Working...'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment