Last active
August 29, 2015 13:57
-
-
Save lorenzoplanas/9370404 to your computer and use it in GitHub Desktop.
DOM hooks
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
// DOM hooks | |
this.$form = finder("form"); | |
this.$inputEmail = finder("input[name='email']"); | |
this.$inputPassword = finder("input[name='password']"); | |
this.$errorMessages = finder(".error"); | |
// Handle login form submit | |
this.logIn = function(e) { | |
e.preventDefault(); | |
this.$errorMessages.remove(); | |
options.user.login({ | |
email: this.$inputEmail().val(), | |
password: this.$inputPassword().val() | |
}) | |
.fail(this.loginError.bind(this)) | |
.done(this.loginSuccess.bind(this)); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment