Link to home
Start Free TrialLog in
Avatar of garora8
garora8

asked on

textbox only allow to enter alphabet in javascript

textbox only allow to enter alphabet in javascript
Avatar of Pratima
Pratima
Flag of India image

This Javascript code will allow only Alphabets in the Textbox. Should call this function onkeypress of the textbox property

function AllowAlphabet(e){      
      if(((keyEntry >= '65') && (keyEntry <= '90')) || ((keyEntry >= '97') && (keyEntry <= '122')) || (keyEntry=='46') || (keyEntry=='32') || keyEntry=='45' )       
      return true;        
else            
return false;}
That is not going to work, since it is unclear what keyEntry is. Add this as the first line of the function:

keyEntry = e.keyCode;



ASKER CERTIFIED SOLUTION
Avatar of havj123
havj123
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garora8
garora8

ASKER

Thanks