- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Check if input value is >= 8 & <=32 & has at least 1 number!?
Pretty sure I’m not doing this correctly:
if (isNaN( $(“#field”).val() ) && val.length >= min && val.length <= max) {
showMessage(‘Your password is good!’);
}
it works?
But i would not use javascript to do this because its easy for the user to alter.
Still isn’t working correctly. :/ I want it to say “Your password is good!” ONLY when there is at least one number in the password, and the password itself needs to be >= 8 chars, and <= 32 chars. I'm sorry if I didn't seem clear. Thanks for the help Mottie!
Thanks for the help man! It works great.
} else if (val.length == nul) {
showMessage(‘Enter in a password!’);
will never get reached (nothing filled in shows ‘Password is too short!’)
} else if (/d/.test(val) && val.length >= min && val.length <= max) { don’t need the if, just `} else {`, because you already know everything else evaluates to true at that point ;)