Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2009 19:50
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save maccman/114347 to your computer and use it in GitHub Desktop.
// 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.
var sub = frm.down("input[type='submit']");
if(sub) sub.disabled = '';
$(frm).observe('submit', function(e){
var sub = frm.down("input[type='submit']");
sub.disabled = 'disabled';
sub.value = 'Working...';
// And now:
$("form.slow input[type='submit']").attr('disabled', '');
var sub = $(this).find("input[type='submit']");
sub.attr('disabled', 'disabled');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment