0

Here's my code

window.addEventListener('keypress', mod, false);
window.addEventListener('keyup', mod, false);

function mod(i) {
  
  var enter = 13;
  
  if(i.keyCode === 49) {
    //basically if key one is pressed then the enter key will be pressed without me touching the enter key
  }
}

SOO, basically is what I'm trying to say is that if 1 is pressed on the keyboard, the enter key will be pressed. Please help, I've been trying to find solutions on this for a very long time

Shed
  • 7
  • 4

1 Answers1

0

Take a look at this post about triggering keypress events programmatically. Basically, you will be able to pass a keyboard event into document.dispatchEvent() inside your if statement and it will trigger the keypress.