HTML5 (common form controls)

Source: Internet
Author: User

Common form controls for HTML5:

Input Type: Color

The color type used in the input field is primarily used to select a color, as follows:

To select a color from the color picker:

Choose the color you like: <input type= "Color" name= "Favcolor" >input type: Email

The email type is used for input fields that should contain e-mail addresses.

When you submit a form, it automatically verifies that the value of the email domain is valid:

E-mail: <input type= "email" name= "email" >input Type: Number

The number type is used for input fields that should contain numeric values.

You can also set a limit on the number of accepted numbers:

Define a numeric input field (qualified):

Quantity (1 to 5): <input type= "number" name= "Quantity" min= "1" max= "5" >

Use the following properties to define the qualification for numeric types:

      • Max-the maximum allowable value
      • Min-Specifies the minimum allowable value
      • Step-Specify a valid number interval (if step= "3", the number of legal is -3,0,3,6, etc.)
      • Value-Specify default value
Input Type: Range

The range type is used for input fields that should contain numeric values in a range.

The range type is displayed as a slider bar.

Define a value that does not need to be very precise (similar to slider control):

<input type= "range" name= "points" min= "1" max= "ten" >

The <datalist> element specifies a list of options for the input field.

The <datalist> attribute specifies that the form or input field should have auto-complete functionality. When the user starts typing in the AutoComplete field, the browser should display the fill-in options in that field:

Use the <input> element's List property to bind to the <datalist> element. If the data is tied back in the background, you can do fuzzy query.

<input> elements use <datalist> predefined values:

<input list= "Browsers" >
<datalist id= "Browsers" >
<option value= "Internet Explorer" >
<option value= "Firefox" >
<option value= "Chrome" >
<option value= "Opera" >
<option value= "Safari" >
</datalist>

HTML5 (common form controls)

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.