Here is example markup:
<form id="formID">
<input type="text" id="filteredInput">
<input type="text" id="anotherInput">
</form>
The following logic can be used to trap for keyboard input (in this case, via a jQuery document ready wrapper).
It may read a little goofy, but basically, I check for everything I want to allow for (in your case, the letters A through Z case insensitive) and do nothing. In other words, the default action is allowed, but any input other than alpha is prevented.
Standard keyboard navigation, such as arrow keys, Home, End, Tab, Backspace, Delete and so forth are checked for and allowed.
NOTE: This code was originally written to satisfy user input permitting only alphanumeric values (A - Z, a - z, 0 - 9), and I left those lines intact as comments.
<script>
jQuery( document ).ready( function() {
// keydown is used to filter input
jQuery( "#formID input" ).keydown( function( e ) {
var _key = e.which
, _keyCode = e.keyCode
, _shifted = e.shiftKey
, _altKey = e.altKey
, _controlKey = e.ctrlKey
;
//console.log( _key + ' ' + _keyCode + ' ' + _shifted + ' ' + _altKey + ' ' + _controlKey );
if( this.id === jQuery( '#filteredInput' ).prop( 'id' ) ) {
if(
// BACK, TAB
( _key === 8 || _key === 9 ) // normal keyboard nav
){}
else if(
// END, HOME, LEFT, UP, RIGHT, DOWN
( _key === 35 || _key === 36 || _key === 37 || _key === 38 || _key === 39 || _key === 40 ) // normal keyboard nav
){}
else if(
// DELETE
( _key === 46 ) // normal keyboard nav
){}
else if(
( _key >= 65 && _key <= 90 ) // a- z
//( _key >= 48 && _key <= 57 && _shifted !== true ) || // 0 - 9 (unshifted)
//( _key >= 65 && _key <= 90 ) || // a- z
//( _key >= 96 && _key <= 105 ) // number pad 0- 9
){}
else {
e.preventDefault();
}
}
});
});
</script>