The key point is tabindex. The design idea is: set a tabindex for each form element, and its value is the value of the tabindex of the previous form element plus one. The function of the function is to first add the current tabindex when the user presses the Enter key. The value of tabindex is increased by one, and then compared with the tabindex value of each form element one by one. If they are equal, the focus is moved to the form element.
First, we need to set an onkeyup event in the form body: