Skip to main content
1 of 2

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);