Попробуйте: ( Это идеальная проверка с использованием jquery validator )
$(function() {
$.validator.addMethod("alphabetsnspace", function(value, element) {
return this.optional(element) || /^[a-zA-Z ]*$/.test(value);
});
$("#add-employee").validate({
rules: {
employee_surname: {
required: true,
alphabetsnspace: true
},
employee_firstname: {
required: true,
alphabetsnspace: true
},
employee_othername: {
alphabetsnspace: true
},
father_name: {
required: true,
alphabetsnspace: true
},
mother_name: {
required: true,
alphabetsnspace: true
},
spouse_name: {
alphabetsnspace: true
},
ssn: {
number: true,
},
phone_no: {
number: true,
},
phone_no2: {
number: true,
},
passport: {
number: true,
},
driving_license: {
number: true,
},
email: {
email: true
}
},
messages:
{
"employee_surname":{
alphabetsnspace: "Please Enter Only Letters"
},
"employee_firstname":{
alphabetsnspace: "Please Enter Only Letters"
},
"employee_othername":{
alphabetsnspace: "Please Enter Only Letters"
},
"father_name":{
alphabetsnspace: "Please Enter Only Letters"
},
"mother_name":{
alphabetsnspace: "Please Enter Only Letters"
},
"spouse_name":{
alphabetsnspace: "Please Enter Only Letters"
},
}
});
});