How to remove the "Enter" in the form, "Submit" and "Enter != Submit"

How to remove the "Enter" in the form, "Submit" and "Enter != Submit"
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

Recommend

HTML table markup tutorial (22): row border color attribute BORDERCOLORLIGHT

Within rows, light border colors can be defined i...

Teach you how to build the vue3.0 project architecture step by step

Table of contents Preface: 1. Create a project wi...

Detailed explanation of mixins in Vue.js

Mixins provide distributed reusable functionality...

A simple method to modify the size of Nginx uploaded files

Original link: https://vien.tech/article/138 Pref...

Promise encapsulation wx.request method

The previous article introduced the implementatio...

MySQL learning database backup detailed explanation

Table of contents 1.DB,DBMS,SQL 2. Characteristic...

HTML form tag usage learning tutorial

Forms in HTML can be used to collect various type...

How to use CURRENT_TIMESTAMP in MySQL

Table of contents Use of CURRENT_TIMESTAMP timest...

Parameters to make iframe transparent

<iframe src="./ads_top_tian.html" all...

MySQL aggregate function sorting

Table of contents MySQL result sorting - Aggregat...

Memcached method for building cache server

Preface Many web applications store data in a rel...

Parsing Linux source code epoll

Table of contents 1. Introduction 2. Simple epoll...

Nginx reverse proxy to go-fastdfs case explanation

background go-fastdfs is a distributed file syste...

Mysql: The user specified as a definer ('xxx@'%') does not exist solution

During the project optimization today, MySQL had ...