How does the HTML button tag work? What does an HTML button tag do?

Source: Internet
Author: User
Tags button type html form
This article mainly introduces the type of HTML button tags, as well as the role and use of HTML button tags, and finally the use of examples, now let's look at this article together

First look at the HTML button label how much do we know?

There are three types of HTML button tags:

    • Type= "Submit": the Submit button (except Internet Explorer, which is the default value for other browsers).

    • Type= "button": Clickable button (the default value for Internet Explorer).

    • Type= "reset": Reset button (clears form data).

PS: When the button tag is included in the form tag, for example:

<form action= "www.php.cn" >    <button> click </button></form>

Now talk about the role of the HTML button tag:

Because button is submit by default in most browsers, if the Action property of the form tag has a value, clicking the button will jump to the link "www.php.cn" It is set to, otherwise clicking on button will refresh the current page.

The,<button> tag in HTML is used to define a button that can be placed in a <button> tag (text, image, etc.). The <input> tag is also defined as a button, and the difference between it and the <button> tag is that the <input> tag is a single label, no element content,<button> tag is a double label, can have element content, so < Button> tags have more powerful features and richer content.

Note: Creating a button in an HTML form generally uses the <input> tag, because if you use the <button> tag in the form, different browsers will submit different values.

The <button> tag is best set with the Type property, because the browser may have different default values for the Type property of the <button> tag.

Now, the use of the HTML button tag:

button more functions inside the button element, you can place content, such as text or images.

<button> controls provide more powerful functionality and richer content than <input type= "button" >. However, the type attribute should be specified at all times in use;

In the form form, the default type of Internet Explorer is "button", while the default value in other browsers, including the Web specification, is "submit".

The use of course is to see the example:

<! DOCTYPE html>
Related Article

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.