-------------------------------------------------- -------------------------------------------------- ----
To realize the problem of "Enter!=Submit", you can generally start from the "type of button" and "number of input boxes".
---------------------------------@chenwei
By default, a single input box, regardless of the button's type="submit" or type="button" type, press Enter to submit.
1. When type="submit", no matter how many type="text" input boxes there are, pressing Enter means submission. (submit)
2. When type="button", and there are multiple input boxes, press Enter not to submit. (button)
3. To solve the problem of pressing Enter to submit a single input box, refer to the second point: you can add an input="text" and hide it; then the type is button.
In actual applications, there is rarely only one input box, so you only need to remember the second item to deal with it.
Using JS events to prevent form submission is beyond the scope of this article, but of course it can be implemented.
-------------------------------------------------- -------------------------------------------------- ----