Javascript validation for text box . Special Characters, Numbers.


/ Published in: PHP
Save to your folder(s)

Special chars, Numbers validation.


Copy this code and paste it in your HTML
  1. <script language=Javascript>
  2.  
  3. function isSpaceKey(evt)
  4. {
  5. var charCode = (evt.which) ? evt.which : event.keyCode
  6.  
  7. if ((charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 123) && charCode != 32 && charCode != 8)
  8. {
  9. alert("Enter Characters Values");
  10. return false;
  11. }
  12.  
  13.  
  14. return true;
  15. }
  16. </script>
  17.  
  18. onkeypress="return isSpaceKey(event);"

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.