Solution to automatically submitting the form and jumping to other pages after pressing Enter on the web page

Solution to automatically submitting the form and jumping to other pages after pressing Enter on the web page
After pressing Enter on the webpage, the form is automatically submitted and goes to other pages

There is a query form. I originally hoped that the query would only be executed when I clicked the query button. However, when I pressed Enter during the test, it went to other pages.

Copy code
The code is as follows:

<form action="notice.php" method="get">
...
<button type='button' onclick ="search_wj()" class="btn btn-ok">Search</button>
</form>

Solution:

Add an onsubmit="search_wj();return false;" to the form

Copy code
The code is as follows:

<form action="notice.php" onsubmit="search_wj();return false;" method="get">
...
<button type='button' onclick ="search_wj()" class="btn btn-ok">Search</button>
</form>

<<:  Implementing WeChat tap animation effect based on CSS3 animation attribute

>>:  Explanation on whether to choose paging or loading in interactive design

Recommend

Detailed explanation of common usage of pseudo-classes before and after in CSS3

The before/after pseudo-class is equivalent to in...

How to build a standardized vmware image for kubernetes under rancher

When learning kubernetes, we need to practice in ...

How to use crontab to add scheduled tasks in Linux

Preface The Linux system is controlled by the sys...

Detailed explanation of the use of the <meta> tag in HTML

In the web pages we make, if we want more people ...

Implementation of Nginx domain name forwarding

Introduction to Nginx Nginx ("engine x"...

Solution to the inaccessibility of Tencent Cloud Server Tomcat port

I recently configured a server using Tencent Clou...

Docker configures the storage location of local images and containers

Use the find command to find files larger than a ...

IIS configuration of win server 2019 server and simple publishing of website

1. First remotely connect to the server 2. Open S...

Correct modification steps for Docker's default network segment

background A colleague is working on his security...

Solution to Ubuntu cannot connect to the network

Effective solution for Ubuntu in virtual machine ...

Detailed example of deploying Nginx+Apache dynamic and static separation

Introduction to Nginx dynamic and static separati...