code for validation of textbox ONLY FOR ALPHABETS doesn't contains any kind of other

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mohinee875
    New Member
    • Apr 2013
    • 1

    code for validation of textbox ONLY FOR ALPHABETS doesn't contains any kind of other

    Hello,

    I would like to get the Javascript code to check the textbox contains only text(alphabets or characters) values not any number or combination of alphabets and numbers or special characters..
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    that should be no problem with regular expressions.

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      hi Mohinee,
      see below
      Code:
      var text=$('#textarea_Id').val();
      if ((/[^a-z\ ]/gi).test(text)) {
      
      			alert(text+ " contains invalid character(s)");
      
      			return false;
      
      		}
      regards,
      Omer Aslam

      Comment

      Working...