SO fiddle
Test Fiddle mainly for SO Questions
by Nick Craver
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/overcast/jquery-ui.css">
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<form id="signupForm" method="get" action="">
<p>Test here, no caps rule: <input name="test" type="text"></p>
<input type="submit" value="Test" />
</form>
JavaScript
$.validator.addMethod("noCaps", function(value, element) {
return this.optional(element) || !/[A-Z]{4}/.test(value);
}, "You are not permitted to input more than three uppercase letters in a row!");
$(function() {
$("form").validate({
rules: {
test: {
noCaps: true
}
},
debug: true,
submitHandler: function() {
alert("Passed!");
}
});
});