0
I have the following input:
Conta Despesa:
<input type="number" name="cod_reduzido">
However, it should only accept specific numbers (there are 30 numbers that are not in sequence, such as: 3111, 3113, 3130, etc)
0
I have the following input:
Conta Despesa:
<input type="number" name="cod_reduzido">
However, it should only accept specific numbers (there are 30 numbers that are not in sequence, such as: 3111, 3113, 3130, etc)
2
It makes no sense for your input type to be number (with the arrow behavior to increment and decrement being that you are not using sequence. So I switched to type="text"
, but I added a parameter called pattern
validates its input through a Regexp.
Since your case is specific with numbers without any logic between you, you will need to write the same nail ! Follow example with the 3 numbers you passed, just add the rest separated by |
(OR).
Conta Despesa:
<input type="text" name="cod_reduzido" pattern="3111|3113|3130">
<input type="submit" value="validar">
Browser other questions tagged javascript html5
You are not signed in. Login or sign up in order to post.
there is no logic, are 30 distinct numbers that are the combination of 4 different codes
– V.Avancini
Then this code will supply the need :D
– Leonardo Bonetti
yes, it is marked as I accept already, thank you very much
– V.Avancini
but one question, it works on all browsers?
– V.Avancini
https://caniuse.com/#feat=input-Pattern
– Renan Gomes