Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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