Archive for July, 2009
Javascript: keyCode versus charCode
Javascript key press events have both a keyCode and a charCode property. These are mutually exclusive – whenever one is non-zero the other is zero.
Which one is set depends on the type of event: keydown and keyup events give one events with keyCode set (they produce corresponding character) whilst keypress events give one events with charCode set.