Skip to content

Instantly share code, notes, and snippets.

@shiftenterdev
Created January 11, 2016 11:04
Show Gist options
  • Save shiftenterdev/4f976d52f2860404bdd4 to your computer and use it in GitHub Desktop.
Save shiftenterdev/4f976d52f2860404bdd4 to your computer and use it in GitHub Desktop.
$('.number').on('keyup blur',function(){
var regx = /^[0-9]+$/i;
var input = $(this).val();
if(!regx.test(input)){
$('.number').val(input.replace(/[a-zA-Z]/g, ''));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment