Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active December 25, 2015 07:49
Show Gist options
  • Save Kcko/6941782 to your computer and use it in GitHub Desktop.
Save Kcko/6941782 to your computer and use it in GitHub Desktop.
JavaScript: only num in input
<input onkeypress="return !isNaN(String.fromCharCode(event.charCode || event.keyCode))">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment