Страница 1 от 1

textbox that only accepts numbers greater than 0

Публикувано на: 03 Ное 2017, 11:27
от Williamhawk
Hello,
I'm looking for a way to make my textbox only accept numbers. It needs to accept all numbers greater or equal to 0 and any number of decimals. No negatives.
I found this online:
<input type="number" min="0" oninput="validity.valid||(value='');">
While this accomplishes almost everything I want, it has this odd glitch of not allowing any numbers in the decimal expansion except 0's. For example, if I type this:
8.0000
...it accepts it, but if I try to type:
8.00001
...it clears the field.
If anyone can help me fix this one glitch, this would be perfect for me. If not, then can anyone suggest an alternative way of doing this?


I didn't find the right solution from the internet.

References:
http://www.htmlforums.com/forum/website ... ter-than-0

advertisement examples

Re: textbox that only accepts numbers greater than 0

Публикувано на: 03 Ное 2017, 15:31
от beyond U
Hello , can you introduce yourself , otherwise i will have to consider you a bot or something.

Regards.