Hello all,
I found this bit of code by AtomicChip:
Can someone expound on what the string for the variable 'regEx' means/is doing?
I need to validate a number field on my form and I need to limit it to 9 or 10 digits. Anything less or more and it needs to throw the alert "Please enter a valid number."
Dave
"Credit belongs to the man who is actually in the arena - T.Roosevelt
I found this bit of code by AtomicChip:
Code:
If you're looking for validation for Zip code (US), try the following:
function Validate(val)
{
var regEx = /[0-9]{5}/;
if(regEx.test(val))
{
alert('Valid Zip Code');
}
else
{
alert('Invalid Zip Code');
}
}
Can someone expound on what the string for the variable 'regEx' means/is doing?
I need to validate a number field on my form and I need to limit it to 9 or 10 digits. Anything less or more and it needs to throw the alert "Please enter a valid number."
Dave
"Credit belongs to the man who is actually in the arena - T.Roosevelt