Created
December 1, 2015 21:49
-
-
Save evanleck/e4d7540d639ca535332e to your computer and use it in GitHub Desktop.
Customizing Native Form Validation
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 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