Home >Backend Development >PHP Tutorial >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?

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?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-20 09:04:161583browse

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>
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