I am trying to use text input (not number) to do number validation for a condition of more than 0. So, it should not accept inputs -1, -2, 0. But 1, 100, 2000, 4000000.. possibly do a limit on it.
Is there a pattern to do something like that using HTML5 validation ? (not js/jq just HTML5 validation)
Here is what I tried but does not fulfill completely my requirements:
- this works perfectly but I dont want to use number type but "text"
<input id="quantity" name="quantity" type="number" min="1" max="100000" required />
- now this uses the type text I want, but it can still accept 0. How to improve on this pattern ?
<input id="quantity" name="quantity" type="text" pattern = "[0-9]{1,5}" required />