Created
December 21, 2015 21:11
-
-
Save mcavaliere/c465ce781c9c5a9b8755 to your computer and use it in GitHub Desktop.
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
var LoginFom = { | |
element: $("form#login-form"), | |
hasErrors: function() { | |
// validation code here... | |
// returns true or false. | |
} | |
}; | |
// ... | |
var ErrorContainer = { | |
element: $("div.form-errors") | |
}; | |
if (LoginForm.hasErrors()) { | |
ErrorContainer.element.show(); | |
} | |
LoginForm.element.addClass("has-errors"); | |
$("input.submit").on("click", function() { | |
ErrorContainer.element.remove(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment