only allow English characters and numbers for text input
Assuming you also want to accept spaces:
$("#user").keypress(function(event){
var ew = event.which;
if(ew == 32)
return true;
if(48 <= ew && ew <= 57)
return true;
if(65 <= ew && ew <= 90)
return true;
if(97 <= ew && ew <= 122)
return true;
return false;
});
If you don't want to accept spaces then remove the if(ew == 32) return true;
JSFiddle
<input type="text" id="firstName" onkeypress="return (event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode >= 48 && event.charCode <= 57)" />
The ASCII Character Set : https://www.w3schools.com/charsets/ref_html_ascii.asp