textbox that only accepts numbers greater than 0

Модератор: Развлечения

Заключено
Аватар
Williamhawk
Новак
Новак
Мнения: 2
Регистриран на: 28 Сеп 2017, 13:18
Ник в играта: Williamhawk
Скайп профил: Williamhawk
Вашият пол е: Мъж
Обратна връзка:

textbox that only accepts numbers greater than 0

Мнение от 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
Аватар
beyond U
Respected
Respected
Мнения: 1149
Регистриран на: 07 Яну 2016, 23:53
Ник в играта: N/A
Обратна връзка:

Re: textbox that only accepts numbers greater than 0

Мнение от beyond U »

Hello , can you introduce yourself , otherwise i will have to consider you a bot or something.

Regards.
"If you talk about those of whom we do not speak, have you not spoken of that about which we do not talk?"
Заключено

Обратно към “Кошче [Теми - 2017г.]”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 3 госта