Html input value less than 0 not allowed in input type number | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Html input value less than 0 not allowed in input type number

Html form input is not allowing me to input a value less than 0 (like 0.5 ) before submitting is there any fix to this

17th Mar 2022, 1:05 PM
Mac Anthony
Mac Anthony - avatar
8 Antworten
+ 1
Just check if the input is valid before sending it... As I already mentioned: ***If you need help, please provide an example code.***
18th Mar 2022, 11:23 AM
Lisa
Lisa - avatar
+ 1
Thanks alot it worked
20th Mar 2022, 9:53 AM
Mac Anthony
Mac Anthony - avatar
0
Use the step attribute. https://www.w3schools.com/tags/att_input_type_number.asp If you need help, please provide an example code.
17th Mar 2022, 1:09 PM
Lisa
Lisa - avatar
0
Step is used to increment the value ....i tried min and max but only works well for integer whole numbers greater than zero
18th Mar 2022, 11:09 AM
Mac Anthony
Mac Anthony - avatar
0
If i use 0.0001 as my min value and 10000 as max ... I wont be able to submit 0.05 or anything 0. Unless it's exactly 0.0001... I don't know if its a programmatic bug in html
18th Mar 2022, 11:13 AM
Mac Anthony
Mac Anthony - avatar
19th Mar 2022, 12:04 PM
Mac Anthony
Mac Anthony - avatar
19th Mar 2022, 12:05 PM
Mac Anthony
Mac Anthony - avatar
0
add step attribute, e.g. step="0.001"
19th Mar 2022, 12:10 PM
Lisa
Lisa - avatar