The button (type=submit) element in the form element will execute the onclick event when the enter key is pressed. How to disable the action?

WBOY
Release: 2016-08-20 09:04:16
Original
1507 people have browsed it

The button (type=submit) element in the form element will execute the onclick event when the enter key is pressed. Then the action will also be executed. What is the order?

Reply content:

The button (type=submit) element in the form element will execute the onclick event when the enter key is pressed. Then the action will also be executed. What is the order?

onsubmit="javascript:return false"

should execute onclick first and then onsubmit

<code>// 禁止表单提交
<form onsubmit="return false;"></form></code>
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!