if your regex is /[0-9]+/ and your intention is to ensure that the input is just numbers. You would be surprised that when you enter ".1" or "1." it still passes.
I am not sure what happened but isNaN also behaves this way.
To ensure that only numbers is valid you would have to set the regex as /^[0-9]+$/
No comments:
Post a Comment