Reputation: 31
I want the value 100, 200, 300, 400, 500 only to be valid in my input. I don't even want value 101. So how should I write the pattern.
Upvotes: 1
Views: 209
Reputation: 150
The easiest and safe way is to use Drop-down field with HTML Tag "select" and add "OPTION" values as 100, 200.
<option value="100">100</option>
<option value="200">200</option>
this will minimize the typo error validation message to user.
Upvotes: 0
Reputation: 10834
Add this to your element:
pattern="[1-5][0][0]"
for example:
<form>
<input type="text" pattern="[1-5][0][0]">
<input type="submit">
</form>
Upvotes: 1