I'm trying to write Javascript code for firstname and lastname validation that contains only a Hebrew characters without numbers or any symbols or any Characters from another language.
I tried to do it and it didn't work that well, The Language is Hebrew, I would like to ensure that the values contain only Hebrew characters, and it's not working that good. It must the user to put Hebrew Characters but if he adds Hebrew Characters he can add numbers or more things and I dont want it to be like that, I want it to be only Characters.
if (fname1.value == "") {
alert("אנא מלא שם פרטי");
return false;
}
if (fname1.value.length < 2) {
alert("שם פרטי חייב להיות גדול מאות אחת ");
return false;
}
if (fname1.value.length > 12) {
alert("שם פרטי חייב להיות קטן מ - 12 אותיות");
return false;
}
if (!(fname1.value >= 'א' && fname1.value <= 'ת' )){
alert("שם פרטי חייב להיות באותיות בעברית ובלי מספרים!");
return false;
}