All I found about this is that there are inconsistencies between different web browsers when it comes to key codes.
I have the following code that works fine when I press enter in Safari, Opera and Chrome, but not in Firefox.
I am using FF 9.0.1
Here are two pieces of code where the problem occurs:
1)
$('#postDiv').on('keydown', '#posttext', function(e) {
if ((e.keyCode == 13 || e.which == 13) && !event.shiftKey) {
post($(this));
}
});
2)
$('.commenttext').live('keydown', function(e) {
if ((e.keyCode == 13 || e.which == 13) && !event.shiftKey) {
comment($(this));
}
});
Both functions are not even called.
Thanks in advance :-) Dennis
EDIT 1
I did some more tests only with e.which and noticed that it works when I don't leave & &! event.shiftKey - apparently FF does not know this command. Is there an alternative to this? I would like the user to be able to press shift + enter without sending a message. I already tried the if condition (e.which == 13 & e.which! = 16), but to no avail.
EDIT 2 - SOLUTION
, ! , e.shiftKey, event.shiftKey! (, , IE).