Possible Duplicate:
How to check for alphanumeric characters
Hai i validate the password in jquery using alphanumbercic.It validate only the letters,Suppose i typed only the numbers it allowed .Kindly guide me
problem
Without using letters it allowed
coding
letters = /^[0-9a-zA-Z]+$/;
if(!password.value.match(letters))
{
alert('Password must be alphanumeric');
signupForm.password.focus();
return false;
}
If your password must contain all the cases: capital letters,small letters and numbers, then you need to create 3 regexps:
then validate like this:
Live demo
docs:
Array.some()
RegExp.test()