Created
August 8, 2013 12:56
-
-
Save bandicsongor/6184335 to your computer and use it in GitHub Desktop.
can be used on textboxes to verify it the pressed key is a letter or not, usage: onkeypress = 'return isLetter(event)'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLetter(evt) | |
{ | |
evt = (evt) ? evt : event; | |
var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); | |
if (charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122)) | |
{ | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment