textbox that only accepts numbers greater than 0
Модератор: Развлечения
- Williamhawk
- Новак
- Мнения: 2
- Регистриран на: 28 Сеп 2017, 13:18
- Ник в играта: Williamhawk
- Скайп профил: Williamhawk
- Вашият пол е: Мъж
- Обратна връзка:
textbox that only accepts numbers greater than 0
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
- beyond U
- Respected
- Мнения: 1149
- Регистриран на: 07 Яну 2016, 23:53
- Ник в играта: N/A
- Обратна връзка:
Re: textbox that only accepts numbers greater than 0
Regards.
Кой е на линия
Потребители разглеждащи този форум: 0 регистрирани и 0 госта