Detect real "hard" character keys only Is there any simple way to detect user keystrokes that result in character input? In other words, ignore all soft keys and modifier keys? This works but seems sort of hacky:

var keycode = event.keyCode ? event.keyCode : event.charCode
if((keycode&gt;=48 &amp;&amp; keycode&lt;=90) || (keycode&gt;=96 &amp;&amp; keycode&lt;=111) || (keycode&gt;=186 &amp;&amp; keycode&lt;=192) || (keycode&gt;=219 &amp;&amp; keycode&lt;=222)){
    alert("realkey")
}
Yes, use keypress events instead of keydown events.  See example: http://jsfiddle.net/7fmjh/6/ - or a non-jquery example: http://jsfiddle.net/7fmjh/11/