Home > Web Front-end > HTML Tutorial > Remove the form's carriage return and submit, carriage return!=submit

Remove the form's carriage return and submit, carriage return!=submit

高洛峰
Release: 2017-03-01 14:49:46
Original
1579 people have browsed it

By default, for a single input box, regardless of the type="submit" or type="button" type of the button, the carriage return is submitted. So how to remove the carriage return of the form and submission? Here is a good example. For reference 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, 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 without submitting. (button)

3. To solve the problem of entering 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 practical 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.

For more information about removing the carriage return from the form, submit and carriage return! = Submit related articles please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template