To implement the "Enter != Submit" problem, you can generally start from the "button type" and "number of input boxes". By default, for a single input box, regardless of whether the button is type="submit" or type="button", pressing Enter means submitting. 1. When type="submit", no matter how many type="text" input boxes there are, pressing Enter means submit. (submit) 2. When type="button" and there are multiple input boxes, pressing Enter does not submit. (button) 3. To solve the problem of submitting when pressing Enter in a single input box, refer to the second point: you can add an input="text" and hide it; then set the type to button. In actual applications, there is rarely only one input box, so you only need to remember the second rule to deal with it. Using JS events to prevent form submission is beyond the scope of this article, but it is certainly possible. |
<<: How to use docker compose to build fastDFS file server
>>: 9 super practical CSS tips to help designers and developers
This article shares the specific code of Vue to i...
js interesting countdown case, for your reference...
This article shares the specific code for impleme...
When I was writing a program a few days ago, I wan...
Previously, my boss asked me to make a program th...
Table of contents What is a trigger Create a trig...
Download the image (optional step, if omitted, it...
Version update, the password field in the origina...
The first web page I designed is as follows: I ha...
There are many reasons why an application is as s...
What is the purpose of this sentence? Copy code Th...
Preface: The most commonly used MySQL logical bac...
Prerequisites A cloud server (centOS of Alibaba C...
Table of contents Requirements encountered in act...
Solution process: Method 1: The default kernel ve...