- /**
- * Validate form field without instantiating validate plug-in.
- *
- * @param {Element|String} element - DOM element or selector
- * @return {Boolean} validation result
- */
- $.validator.validateElement = function (element) {
- var form, validator, valid, classes;
-
- element = $(element);
- form = element.get(0).form;
- validator = form ? $(form).data('validator') : null;
-
- if (validator) {
- return validator.element(element.get(0));
- }
- valid = true;
- classes = element.prop('class').split(' ');
- $.each(classes, $.proxy(function (i, className) {
- if (this.methods[className] && !this.methods[className](element.val(), element.get(0))) {
- valid = false;
-
- return valid;
- }
- }, this));
-
- return valid;
- };