Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
can be used on textboxes to verify it the pressed key is a letter or not, usage: onkeypress = 'return isLetter(event)'
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
You can’t perform that action at this time.