Skip to main content
added 177 characters in body
Source Link
Ctrl-C
  • 4.2k
  • 1
  • 28
  • 30

Timing approach is wrong - how do you know how long the action will take on client's browser?

How to do it

$('form').submit(function(){ $(this).find(':submit').attr('disabled','disabled'); }); 

When form is submitted it will disable all submit buttons inside.

Remember, in Firefox when you disable a button this state will be remembered when you go back in history. To prevent that you have to enable buttons on page load, for example.

Timing approach is wrong - how do you know how long the action will take on client's browser?

How to do it

$('form').submit(function(){ $(this).find(':submit').attr('disabled','disabled'); }); 

When form is submitted it will disable all submit buttons inside.

Timing approach is wrong - how do you know how long the action will take on client's browser?

How to do it

$('form').submit(function(){ $(this).find(':submit').attr('disabled','disabled'); }); 

When form is submitted it will disable all submit buttons inside.

Remember, in Firefox when you disable a button this state will be remembered when you go back in history. To prevent that you have to enable buttons on page load, for example.

Source Link
Ctrl-C
  • 4.2k
  • 1
  • 28
  • 30

Timing approach is wrong - how do you know how long the action will take on client's browser?

How to do it

$('form').submit(function(){ $(this).find(':submit').attr('disabled','disabled'); }); 

When form is submitted it will disable all submit buttons inside.