Skip to content

Instantly share code, notes, and snippets.

@guilhermehn
Created September 28, 2012 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermehn/3800124 to your computer and use it in GitHub Desktop.
Save guilhermehn/3800124 to your computer and use it in GitHub Desktop.
JavaScript: Campo numérico (jQuery)
$(".numerico").keypress(function(e){
var charcode = e.keyCode ? e.keyCode : e.which;
if(charcode < 48 || charcode > 57){
e.preventDefault();
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment