In the below code snippet, I will show you how to trigger the button click event on the ‘enter’ keypress event. Also, the keyCode of the ‘Enter’ key is 13. Here are the steps that we will follow:
- First, we will get the element ID of the input box
- And then, we will trigger the button’s click event.
Form will look like: