Created
October 21, 2014 20:58
-
-
Save uhtred/25d09f451c8aebc6a1ae to your computer and use it in GitHub Desktop.
JS:jQuery Validate Tip To Disable Onkeyup Event In One Field.
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
jQuery.validator.setDefaults({ | |
onkeyup: function(element) { | |
var _this = this, | |
$element = $(element), | |
element_id = $element.attr('id'), | |
classes = $element.attr('class') || ''; | |
$.each(classes.split(' '), function() { | |
if (this in $.validator.classRuleSettings && $.validator.classRuleSettings[this].onkeyup !== false) { | |
$.validator.defaults.onkeyup.apply(_this, arguments); | |
return false; | |
} | |
}); | |
if (this.settings.rules[element_id] && this.settings.rules[element_id].onkeyup !== false) { | |
$.validator.defaults.onkeyup.apply(this, arguments); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment