-Dman100-
asked on
error validating number 4 or 5 digits
I am hoping a javascript guru can help me debug a problem with a validation function. I have a simple javascript function that validates an input that must be numeric and 4 or 5 digits. However, it appears to be causing errors.
See below for the validation function.
Thanks for any help.
See below for the validation function.
Thanks for any help.
This code causes errors:
function checkemployeenumber(input) {
var str=input.value;
var filter = /^[0-9]{4,5}$/;
if (filter.test(str)) {
return true;
}else{
return false;
}
}
If I change to just validate 5 digits like this it works:
function checkemployeenumber(input) {
var str=input.value;
var filter = /^[0-9]{5}$/;
if (filter.test(str)) {
return true;
}else{
return false;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you for the assist, and the points.
Good luck & have a great day.
Good luck & have a great day.
ASKER