currently I have the following code
<input type="number" />
it comes out to something like this
The little selector things on the right allow the number to go into negative. How do I prevent that?
I am having doubts about using type="number"
, it is causing more problems than it is solving, I am going to sanity check it anyways, so should I just go back to using type="text"
?
Add a min
attribute
<input type="number" min="0">
I have found another solution to prevent negative number.
<input type="number" name="test_name" min="0" oninput="validity.valid||(value='');">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With