I myself updated the validator JavaScript validation code (so instead of updating it, I now stick to my version 1.8.1), but here's what I did (around line 767):
classRules: function(element) { var rules = {}; var classes = $(element).attr('class'); classes && $.each(classes.split(' '), function() { if (this in $.validator.classRuleSettings) { $.extend(rules, $.validator.classRuleSettings[this]); } if (this.toLowerCase().lastIndexOf('maxlength-', 0) === 0) {
I added an extra if-test for "maxlength-", so now I can add a class such as "maxlength-10" to limit 10. Of course, I could also add minlength, etc.
source share