Input only javascript

I have input

one that only allows number. but if I make a copy to paste something else then the number it will resolve.

How can I make sure it resolves a number and nothing else (even after copying)

<input type="text" name="people" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/>
      

Run codeHide result


+3


source to share





All Articles