With Kingdz learn HTML5 12 HTML5 Form element new property

Source: Internet
Author: User

This lesson adds to the knowledge that some of the previous courses have no contact with them.

In XHTML, the subordinate elements within the form must be written inside the form, but in HTML5, they can be written anywhere on the page, then a form property is set for the element, and the property value is the ID of the form unit, so that it can be declared that the element belongs to the specified form.

Well, I think it's a novelty for us.

<! DOCTYPE html>

The advantage of this is that when you need to add styles to elements in a page, you can add them more easily because they are not scattered within the form.

The form override property (Form override attributes) allows you to override some of the property settings of a FORM element.

Form Override properties are:

    • FormAction-Override the form's Action property
    • Formenctype-Rewrite the Enctype property of the form
    • FormMethod-Override the form's Method property
    • Formnovalidate-Rewrite the Novalidate property of the form
    • Formtarget-Override the target property of the form

Note: Form override properties apply to the following types of <input> tags: submit and image.

Take the first example, formaction can rewrite, that is, in a form, we can submit this form to a different page. is not very strong AH.

    <form action= "1.html" id= "Testrorm" >        <input type= "Submit" value= "submit to 1" formaction= "1.html"/>        <input type= "Submit" value= "Submit to 2"  formaction= "2.html"/>        <input type= "Submit" value= "submit to 3"  formaction= "3.html"/>    </form>

Haha, it's great, I didn't think about it before.

Placeholder Property

This is the hint text <input type= "text" placeholder= "hint text"/>

Autofocus Property

Adds the property to the text box, selection box, or button control. When the page loads, the control automatically gets the cursor focus. To do this, you need to use JavaScript so far.

AutoComplete property

Previous courses have also been exposed, which is an auto-complete attribute

Max/min/step Property

The Min, max, and step properties are used to specify a qualification (constraint) for input types that contain numbers or dates.

The Max property specifies the maximum allowable value for the input field.

The Min property specifies the minimum allowable value for the input field.

Step property specifies a valid number interval for the input field

Height and Width properties

The Height and Width properties specify the image heights and widths for the input label of the image type.

The height and Width properties apply only to the <input> label of the image type.

Multiple Property

The Multiple property specifies that multiple values can be selected in the input field.

Note: The Multiple property applies to the following types of <input> tags: email and file.

This need to match what DataList used the

Pattern Property

The Pattern property specifies the mode (pattern) used to validate the input field. The value is, of course, a regular expression.

Required Property

The Required property specifies that the input field must be filled in before submission (cannot be empty). "Legendary non-null verification"

Well, to the present position, basically we have a more profound understanding of HTML5, Haha, the rest is our application.

With Kingdz learn HTML5 12 HTML5 Form element new property

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.