Skip to main content
2 of 2
added 460 characters in body
Michael Chourdakis
  • 11.2k
  • 3
  • 52
  • 95

I have been using blockUI to avoid browser incompatibilies on disabled or hidden buttons.

http://malsup.com/jquery/block/#element

Then my buttons have a class autobutton:

 $(".autobutton").click( function(event) { var nv = $(this).html(); var nv2 = '<span class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></span> ' + nv; $(this).html(nv2); var form = $(this).parents('form:first'); $(this).block({ message: null }); form.submit(); }); 

Then a form is like that:

<form> .... <button class="autobutton">Submit</button> </form> 
Michael Chourdakis
  • 11.2k
  • 3
  • 52
  • 95