Last active
December 6, 2017 08:41
-
-
Save MSerj/f9930e254e65aa9e51e1d85944c3f5f8 to your computer and use it in GitHub Desktop.
only numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//only-numbers | |
$(".only-numbers").on("keypress", function (evt) { | |
var charCode = (evt.which) ? evt.which : event.keyCode; | |
return !(charCode > 31 && (charCode < 48 || charCode > 57)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment