In Internet Explorer 8
, event.which
is showing undefined
and working fine in FireFox and IE 9
. I am using the Textbox
'onkeypress' Event
MarkUp
<asp:TextBox runat="server" ID="tb1" MaxLength="3"
onkeypress="return MainCheckStrings(event);" />
It is working fine in FF, Chrome, Safari and Internet Explorer - 9
Any Idea?
The documentation clearly shows that this property is available only from IE 9 onwards.
In IE prior 9 the even object is not the same as others so you need to handle that case specifically and same goes for the which property.
Here is a good article on the subject that should explains everything clearly http://www.quirksmode.org/js/keys.html