Differences between button and submit in HTML input

Source: Internet
Author: User

Type = button:It is simply a button function.

Type = submit:Submit Form

For example:

<Input type = "submit" name = "name" value = "submit" onclick = "on_submit_click ()"/>
<Input type = "buttont" name = "name" value = "Submit" onclick = "on_submit_click ()"/>

After clicking the submit button, the first one is forwarded to the action, which is automatically submitted. The onclick function is not used;

The second step is to execute the onclick function and jump to Js. Form submission in JS is as follows:

Document. form name. Submit ();

In addition, people engaged in Web UI should note that using submit to improve the ease of use of pages:

After submit is used, the page supports the Enter key operation. Many Web software designers may not notice that the submit is unified.

After a button is used, the page usually does not support the Enter key. Therefore, the Enter key must be supported and a submit must be set. The default enter key is used to operate the first submit on the page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.