Skip to content

Instantly share code, notes, and snippets.

@dzaporozhets
Created October 3, 2012 10:57
Show Gist options
  • Save dzaporozhets/3826391 to your computer and use it in GitHub Desktop.
Save dzaporozhets/3826391 to your computer and use it in GitHub Desktop.
Disable form buttons while a form is submitting
$ ->
# 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