Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created March 10, 2013 15:34
Show Gist options
  • Save hughfdjackson/5129013 to your computer and use it in GitHub Desktop.
Save hughfdjackson/5129013 to your computer and use it in GitHub Desktop.
var validators = {
password: function(pass) {
return /[0-9]/.test(pass) && pass.length > 10
}
}
var validate = function(el){
return validators[el.getAttribute('data-validator')](el.value)
}
var isValid = validate(document.getElementById('my-password'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment