Reputation: 959
Example on focus out I want to check if the input has any characters that are not in english. Is this possible in JavaScript?
Upvotes: 0
Views: 1189
Reputation: 10627
Keeping this very simple.
document.getElementById('test').onkeyup = function(){
if(this.value.match(/^[a-z0-9_.,'"!?;:& ]+$/i)){
console.log('English');
}
else{
console.log('Not English');
}
}
<input id='test' value='' />
Upvotes: 1