time you should probably use Open a link without clicking on it using JavaScript. This seems like a duplicate but I don't see anything to substitute enter for tab code Tab key already knows to skip hidden and use tab orders. But that should get you going the right way. off with this. How can I add new array elements at the beginning of an array in JavaScript? ; Then, register a keydown event listener and log the key and code of the key that has been pressed. Your email address will not be published. You can find out which key code to use at By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. The keyup event on the other hand sets the flag variable to indicate that the key has been released. Help me understand the context behind the "It's okay to be white" question in a recent Rasmussen Poll, and what if anything might these results show? Keyboard events are only generated by ,