Skip to content

Instantly share code, notes, and snippets.

@BlaShadow
Created November 25, 2013 13:08
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 BlaShadow/7640954 to your computer and use it in GitHub Desktop.
Save BlaShadow/7640954 to your computer and use it in GitHub Desktop.
Num validation on key event with jQuery/Javascript
jQuery(document).on('keypress','[data-val="number"]',function(event){
var key = event.charCode;
if( ( key == 0 || (key < 58 && key > 46) ) == false )
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment