Frage

I have just added in Tab as a control in my project and every time the Tab key is pressed it jumps the address bar once I try to do another key press. This happens only after Tab does what it's supposed to in the scene. How would I go about fixing this? Is this due to the fact that I'm running the program from a windows path and not a web address?

War es hilfreich?

Lösung

Try preventDefault:

document.addEventListener("keydown", function(e) {
    e.preventDefault(); //prevent default event action

    //do your stuff
    var iKeyCode = e.keyCode;

    console.log("keydown: ", iKeyCode);

}, false);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top