Created
October 16, 2014 17:29
-
-
Save uhtred/fc9ac29e6ff8941a963e to your computer and use it in GitHub Desktop.
JS: Validate Scope Using jQuery Validate
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
'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