I have an input tag of type text.
The user is supposed to enter a float or int, greater than 4. How to I verify that the user has not entered any non-numeric characters ? Decimal points are ok:
For example:
- 10.1 (ok)
- 10 (ok)
- 10$ (not ok)
- abcs (not ok)
- .0.12 (not ok -> Too many periods)
- 4 (not ok -> number must be greater than 4)
- 1a (not ok)
How do I do this? Parsing each and every character in the text box seems clumsy, and I'm don't know think I can do this with a regex. Any suggestions ?