using jQuery here, however unable to prevent numbers from being typed into the input field
http://codepen.io/leongaban/pen/owbjg
Input
On newer browsers, you can use:
<input type="text" name="country_code"
pattern="[A-Za-z]" title="Three letter country code">
You can use regular expressions to restrict the input fields.
<input type="text" name="name" id="event" onkeydown="return alphaOnly(event);" required />
function alphaOnly(event) {
var key = event.keyCode;`enter code here`
return ((key >= 65 && key <= 90) || key == 8);
};
Short ONELINER:
<input onkeypress="return /[a-z]/i.test(event.key)" >
For all unicode letters try this regexp: /\p{L}/u
(but ... this) - and here is working example :)