Validating alphabetic only string in javascript

Posted by Click Upvote on Stack Overflow See other posts from Stack Overflow or by Click Upvote
Published on 2010-03-15T21:30:54Z Indexed on 2010/03/15 21:39 UTC
Read the original article Hit count: 120

Filed under:
|

How can I quickly validate if a string is alphabetic only, e.g

var str = "!";
alert(isLetter(str)); // false

var str = "a";
alert(isLetter(str)); // true

Edit : I would like to add parenthesis i.e () to an exception, so

var str = "(";

or

var str = ")";

should also return true.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery