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.

July 26, 2009 at 11:35 pm Leave a comment


July 2009
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031