I have a textbox and i want the input for the textbox to satisfy to conditions: a) It should be a number b) It be should be greater than 5. What should be the regular expression for that?
1 Answer
Instead of regex you can use <input type='number'... Check snippet below
<input type="number" name="quantity" min="6" />
8 Comments
kojow7
Not sure why this got downvoted, I think it is a worthy answer.
Aarthna Maheshwari
@DucFilan Ya its not working if we directly enter the number.
Super User
@AarthnaMaheshwari it automatically validate the value on
submit or blur event. You can check.SacrumDeus
@DucFilan This kind of specification will be supported by the most browsers, including the old ones.
Duc Filan
It's not supported in IE<10.
|
(([1-5]\d|[6-9]))$see the test results here