Home >Web Front-end >HTML Tutorial >Press Enter to automatically submit the form and unexpected discovery_HTML/Xhtml_Web page production
Press Enter to automatically submit the form and unexpected discovery_HTML/Xhtml_Web page production
WBOYOriginal
2016-05-16 16:39:181145browse
Copy code
The code is as follows:
When you press Enter in the name input box of the above form, the form will be submitted. And there is no submit button in the form.
After many searches, I finally found the reason: If there is only one text box in the form, then when you press Enter, the form will be submitted.
So the solution is easy, just add a useless text box and hide it.
Copy code
The code is as follows:
Note: Adding a hidden box will not work.
Copy code
The code is as follows:
Statement:
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