Created
October 3, 2012 10:57
-
-
Save dzaporozhets/3826391 to your computer and use it in GitHub Desktop.
Disable form buttons while a form is submitting
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
$ -> | |
# Disable form buttons while a form is submitting | |
$('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) -> | |
buttons = $('[type="submit"]', this) | |
switch e.type | |
when 'ajax:beforeSend', 'submit' | |
buttons.disable() | |
else | |
buttons.enable() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment