Answers for "How to make HTML input tag only accept numerical values? in jsx"

0

How to make HTML input tag only accept numerical values? in jsx

<input
      onKeyPress={(event) => {
        if (!/[0-9]/.test(event.key)) {
          event.preventDefault();
        }
      }}
    />
Posted by: Guest on April-16-2021

Code answers related to "How to make HTML input tag only accept numerical values? in jsx"

Code answers related to "Javascript"

Browse Popular Code Answers by Language