Home >Web Front-end >H5 Tutorial >Is submit a button in html5?
Submit is a button in HTML5. It is a special case of button. It automatically integrates the submission action. Submit will automatically submit the form data. When using submit, you need to verify and add return true or false.
The operating environment of this article: windows10 system, html 5, thinkpad t480 computer.
Submit is a special case of button and a type of button. It automatically integrates the submission action.
If the form needs to be processed with JS (including input verification) after clicking the submit button before submitting it, you usually have to change submit to button, that is, cancel its automatic submission behavior. Otherwise, it will cause The effect of submitting twice, for dynamic web pages, is to operate the database twice. Or add return true or false when verifying when using submit.
Submit and button are both displayed in the form of buttons. They both look like buttons. The difference is in the type attribute and the event that is sent in response. Submit will submit the form, but button will not submit the form.
Submit is a special button that will automatically submit the form data. If the onClick method does not add return, it will automatically submit and will not act as a constraint. Therefore, if you need to verify when using submit, please add return true or false.
Example: , when judging in JS, write return true; Or return false;
Recommended learning:html tutorial
The above is the detailed content of Is submit a button in html5?. For more information, please follow other related articles on the PHP Chinese website!