Skip to content

Instantly share code, notes, and snippets.

@matt-diehl
Last active April 21, 2017 21:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save matt-diehl/5188186 to your computer and use it in GitHub Desktop.
Save matt-diehl/5188186 to your computer and use it in GitHub Desktop.
var ContactForm = (function () {
var s;
return {
settings: {
inputs: $("#contact_form input"),
submitBtn: $(".js-contact_form-submit")
},
init: function() {
s = this.settings;
this.bindUIActions();
},
bindUIActions: function () {
s.submitBtn.on("click", function() {
if (!ContactForm.validate()) {
// If it doesn't validate, show some errors
}
});
},
validate: function (s.inputs) {
inputs.each(function() {
// Do some validation here.
}
}
};
})();
ContactForm.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment