Skip to content

Instantly share code, notes, and snippets.

@pablocattaneo
Created January 11, 2019 20:59
Show Gist options
  • Save pablocattaneo/d6ba8065fe36879d717b255d2966b391 to your computer and use it in GitHub Desktop.
Save pablocattaneo/d6ba8065fe36879d717b255d2966b391 to your computer and use it in GitHub Desktop.
How to make input only accept numbers between 0 and 10 Avoiding +,-,. and e Source: https://stackoverflow.com/a/32784911/3599272
<input onkeypress="return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57" min="0" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment