window.onkeydown = function(e) {
var code = e.keyCode ? e.keyCode : e.which;
if (code === 71) {
alert("hi");
}
};
window.onkeyup = function(e) {
var code = e.keyCode ? e.keyCode : e.which;
if (code === 69) {
alert("hi");
}
};
dont mind the following text!! I thought this would be answered somewhere on SO, but I can't find it.
If I'm listening for a keypress event, should I be using .keyCode or .which to determine if the enter key was pressed?
I've always done something like the following:dont mind this text!!