Skip to content

Instantly share code, notes, and snippets.

@muthugit
Created March 22, 2018 20:23
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 muthugit/460acd0c98124e8caff06e6eeacf9640 to your computer and use it in GitHub Desktop.
Save muthugit/460acd0c98124e8caff06e6eeacf9640 to your computer and use it in GitHub Desktop.
How to stop special characters from input box runtime?
$('#inputBoxId').keypress(function(e) {
if (!/[a-zA-Z-]/.test(String.fromCharCode(e.which)))
return false;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment