function validateFor9DigitNumber() {
var txt = document.getElementById('<%= txt9Digit.ClientId %>');
var textValue = parseInt(txt.value);
var regSSN1 = new RegExp("^\d{9}$");
if (isNaN(textValue))
alert("Not a Number");
else {
alert("A Number");
alert(regSSN1.test(textValue));
}
}
I needed a Javascript function that would pattern match a text value for 9-digit number.
In the above needed function, I do land up in the else part and get the message "A Number", but then receive a FALSE for the next validation.
When I enter a 9-digit number say 123456789. I get FALSE even with egSSN1.match(textValue).
Where am I going wrong?