Skip to content

Instantly share code, notes, and snippets.

@tlux
Last active December 17, 2015 01:59
Show Gist options
  • Save tlux/5532218 to your computer and use it in GitHub Desktop.
Save tlux/5532218 to your computer and use it in GitHub Desktop.
Submit Disabler for Rails
$doc = $(document)
$doc.on 'submit', "form:not([data-remote='true'])", ->
$(@).find(':submit').prop('disabled', true)
$doc.on 'ajax:beforeSend', "form[data-remote='true']", ->
$(@).find(':submit').prop('disabled', true)
$doc.on 'ajax:complete', "form[data-remote='true']", ->
$(@).find(':submit').prop('disabled', false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment