Skip to content

Instantly share code, notes, and snippets.

@uhtred
Created October 16, 2014 17:29
Show Gist options
  • Save uhtred/fc9ac29e6ff8941a963e to your computer and use it in GitHub Desktop.
Save uhtred/fc9ac29e6ff8941a963e to your computer and use it in GitHub Desktop.
JS: Validate Scope Using jQuery Validate
'validate--scope-dependence': {
required: function(element) {
var hasFilled = !!$(element).closest('.validate--scope')
.find('input, select, textarea')
.not( element )
.filter(function() {
return $(this).val().length > 0;
}).length;
return hasFilled;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment