Reputation: 169
I have a form which contains a textbox. i want the textbox to accept only three numbers i.e. 1, 3 or 6. How can i apply such a validation at the client side.
<input type="number" name="NumberOfDays" min="1" />
Upvotes: 1
Views: 35
Reputation: 167172
Using RegEx pattern, you can validate the input. The input will not accept anything other than 1
or 3
or 6
. Try adding some value and submitting it. And remove the type="number"
, if you are using pattern
.
<form>
<input pattern="[1|3|6]{1}" name="NumberOfDays" min="1" />
<input type="submit" />
</form>
Upvotes: 1