Can anyone help me how I can able to validate the cell number using JavaScript? Herewith I have attached my code which is given an error even after I was entering 10 digits for phone number:
if(number.value == "") {
window.alert("Error: Cell number must not be null.");
number.focus();
return false;
}
if(number.length != 10) {
window.alert("Phone number must be 10 digits.");
number.focus();
return false;
}
Any help would be appreciated.