Catch the enter key while submit a form
2023-03-21
1 min read
(link)[https://stackoverflow.com/questions/13987300/how-to-capture-enter-key-press]
add a onkeypress event ang judge the event.Code whether is 13 which symbolize the Enter key.
pay attention to where the onkeypress event should add => the text input !! text input will automatically catch the key 'enter' as a submit action, thus, if you do not want to refreash the page, you should add a keypress function to catch the 'enter'