I have the following Javascript:
$(function(){
$("#foo").keypress(function (event) {
if (event.keyCode == 13) {
console.log(event.ctrlKey ? "Ctrl+Enter (13)" : "Enter (13)");
}
else if (event.keyCode == 10) {
console.log(event.ctrlKey ? "Ctrl+Enter (10)" : "Enter (10)");
}
});
});
Foo in this case is an input box.
Under Windows, and Windows only - holding down the CTRL modifier changes the keyCode from 13
to 10
. So if I do Enter v.s. CTRL + Enter, I see Enter (13)
and Ctrl+Enter (10)
in the console. Mac OS and Linux don't do this regardless of browser.
Why is this?
Fiddle to play with at http://jsfiddle.net/K6NhF/