As @dreta said there's only one way and it's by using a keypress
event handler just like this:
var keyInput = document.getElementById("keyInput");
function inputFunc(e) {
If (e.keyCode == 82) {// 82 = R
//Do Something
};
};
keyInput.addEventListener("keypress", inputFunc);
You can also visit this website where you can check the keyCode char keyCode char