how to make html input tag only accept numerical values 3f in jsx

Solutions on MaxInterview for how to make html input tag only accept numerical values 3f in jsx by the best coders in the world

showing results for - "how to make html input tag only accept numerical values 3f in jsx"
Juan
10 Mar 2018
1<input
2      onKeyPress={(event) => {
3        if (!/[0-9]/.test(event.key)) {
4          event.preventDefault();
5        }
6      }}
7    />
8
similar questions