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 field.
On Windows and only Windows - CTRL modifier containment changes keyCode from 13 to 10 . Therefore, if I do Enter vs CTRL + Enter , I see Enter (13) and Ctrl+Enter (10) in the console. Mac OS and Linux do not do this regardless of browser.
Why is this?
Try playing with http://jsfiddle.net/K6NhF/
source share