Reputation: 147
I am trying to set few numbers into <input type="number">
like 22,33,44, but after submited my form, the value into my input tag is "", if I set only two numbers it works like "22.33", but with 3 numbers validation is not pass. How can I set 3 numbers or more and pass the validation?
Upvotes: 0
Views: 715
Reputation: 200
You need to use type text and perform the validations using regex or string manipulation. input type = number is used to set only single value like 22 or 33 or 44 but not combination i.e. "22,33,44".
Upvotes: 0
Reputation: 1152
Into <input type="number">
you can inser only a number, "22.33" is still a signle number, but it's decimal, not an intere which is correct.
If you want to insert multiple numbers separated by comma (,) you have to use <input type="text">
and then parse the content of the input.
Upvotes: 0
Reputation: 2023
the issue is the commas ',' you have. Input type 'number' only takes in numbers, it is invalid with commas, remove comma and it should work
Upvotes: 0