Last active
August 29, 2015 13:59
-
-
Save tony612/10581599 to your computer and use it in GitHub Desktop.
A very simple validation used with twitter bootstrap
This file contains hidden or 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
| $('.register-modal #send_to_congress').click -> | |
| validated = true | |
| $('form .validating').each -> | |
| $parent = $(@).parent() | |
| $(@).keyup -> | |
| if !@value | |
| $parent.removeClass('has-success').addClass('has-error') | |
| else | |
| $parent.removeClass('has-error').addClass('has-success') | |
| if !@value | |
| $parent.addClass('has-error') | |
| validated = false | |
| true | |
| if validated | |
| console.log "Submit" | |
| $('.register-modal form').submit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment