Skip to content

Instantly share code, notes, and snippets.

@terehof
Created March 17, 2015 12:56
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 terehof/003ccba6bc4878d68a16 to your computer and use it in GitHub Desktop.
Save terehof/003ccba6bc4878d68a16 to your computer and use it in GitHub Desktop.
validation number by class
$('body').on('keydown','.validate_numeric',function(e){
var specialKeys = new Array();
specialKeys.push(8,37,39,46,190);
var keyCode = e.which ? e.which : e.keyCode;
cl(keyCode);
var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1);
if(!ret)
return false;
});
// стрелки, цифры, бекспейс
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment