Home > Article > Web Front-end > Code to control carriage return event using JS_javascript skills
Our operating habit is indeed to use Enter to submit data directly. After some inspection of the project, it was found that the page was not designed well, which caused the browser to regard the logout button as the default button when loading, so the logout button event was triggered as soon as Enter was pressed. Considering a huge project, it is unrealistic to change the page design for this problem. Moreover, the customer requires that the "Save" button event be triggered when the Enter button is pressed when there is a "Save" button, and it is triggered when there is a "Next" button. Events, when there is a "Submit" button, the corresponding events are triggered, etc. If you change the pages one by one, the workload will be staggering. So I considered using js directly in the template header file to trigger the event of the Enter button in the entire site. The following is the corresponding code: