H
H
Httdientee2021-07-17 11:51:42
JavaScript
Httdientee, 2021-07-17 11:51:42

How to disallow certain characters in input?

In input number now you can enter "+", "-", "." how can it be banned? Maybe a regular expression

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2021-07-17
@sergiks

By event , "input"replace valuewith a positive integer value:

Newans: remember the previous valid value, so that, if anything, if NaN, do not reset the field, but return to the last normal one.

D
Dmitry Mazikin, 2021-07-17
@DancingGod68

N
Nadim Zakirov, 2021-07-17
@zkrvndm

htmlbook.ru/html/input/pattern

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question