How to check if string contains Latin characters only?
No jQuery Needed
if (str.match(/[a-z]/i)) {
// alphabet letters found
}
You can use regex:
/[a-z]/i.test(str);
The i
makes the regex case-insensitive. You could also do:
/[a-z]/.test(str.toLowerCase());
Ahh, found the answer myself:
if (/[a-zA-Z]/.test(num)) {
alert('Letter Found')
}