I\'m using the validate plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation/
What i\'m trying to find is a way to make some of my form fields a
Add cdn
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
rules:{
txtname:{required: true,
lettersonly:true
}
Use below code in your script. this will add a new clause to your validator.
$.validator.addMethod(
"alphabetsOnly",
function(value, element, regexp) {
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
},
"Please check your input values again!!!."
);
$("#formElement").rules("add", {alphabetsOnly: "^[a-zA-Z'.\\s]$" })