How to make type="number" to positive numbers only
I have found another solution to prevent negative number.
<input type="number" name="test_name" min="0" oninput="validity.valid||(value='');">
Add a min
attribute
<input type="number" min="0">
It depends on how precise you want to be. It you want to accept only integers, than:
<input type="number" min="1" step="1">
If you want floats with, for example, two digits after decimal point:
<input type="number" min="0.01" step="0.01">