Home >Web Front-end >HTML Tutorial >How to remove the form's carriage return, submit, carriage return!=Submit_HTML/Xhtml_Webpage Production
To solve the problem of "Enter!=Submit", you can generally start from "the type of button" and "the number of input boxes".
By default, for a single input box, regardless of the type="submit" or type="button" type of the button, pressing Enter will 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, pressing Enter will not submit. (button)
3. To solve the problem of pressing Enter and submitting 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.