I have this …
$(document).keypress(function(e) {
if ( e.keyCode === 119 ) // w
doSomething();
});
Wo when pressing "w" on my document the doSomething()
function fires. How can I prevent it from firing when I'm currently typing (in focus) in an input
field or textarea
?