How can I use jQuery to validate (on keyup) that a text input only contains latin letters (only_english = 'abcdAbDKDk',), without using a plugin?
How can I use jQuery to validate (on keyup ) that a text input
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try something like this:
If you want to allow spaces, add that to the statement above (|| event.which == 32). You will need extra logic somewhere (perhaps in a change event, or keyup) to remove illegal chars from the string when users paste a value into the input.
JSFiddle example.