Skip to content

Instantly share code, notes, and snippets.

@evanleck
Created December 1, 2015 21:49
Show Gist options
  • Save evanleck/e4d7540d639ca535332e to your computer and use it in GitHub Desktop.
Save evanleck/e4d7540d639ca535332e to your computer and use it in GitHub Desktop.
Customizing Native Form Validation
var validateForm = function(submitEvent) {
/* We'll fill this in incrementally. */
};
document.addEventListener('DOMContentLoaded', function() {
var forms = document.querySelectorAll('form');
for (var index = forms.length - 1; index >= 0; index--) {
var form = forms[index];
form.noValidate = true;
form.addEventListener('submit', validateForm);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment