New form attributes for HTML5

1 New form attribute:
   autocomplete The
autocomplete attribute The
autocomplete attribute specifies that the form or input field should have the autocomplete function.
Note: autocomplete works with <form> tags, as well as the following types of <input> tags: text, search, url, telephone, email, password, datepickers, range and color.
When the user starts typing in the autocomplete field, the browser should display the filled in options in the field

PS: Vernacular: This attribute is the value of the last input text box that can be clicked

<form action="demo_form.asp" method="get" autocomplete="on">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
E-mail: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form>


2 New input attributes:
  2.1 autofocus: The attribute specifies that when the page loads, the field automatically gets the focus, applicable to all types of <input> tags
User name: <input type="text" name="user_name" autofocus="autofocus " />
  2.2
   Note: The form attribute applies to all types of <input> tags. The form attribute must refer to the id of the owning form:
  
<form action="demo_form.asp" method="get" id="user_form">
First name:<input type="text" name="fname" />
<input type="submit" />
</form>
Last name: <input type="text" name="lname" form="user_form" />


2.3
list attribute
The list attribute specifies the datalist of the input field. datalist is a list of options for the input fields.
Note: The list attribute applies to the following types of <input> tags: text, search, url, telephone, email, date pickers, number, range and color.
Webpage: <input type="url" list="url_list" name="link" />
<datalist id="url_list">
<option label="W3Schools" value="http://www.w3school.com.cn" />
<option label="Google" value="http://www.google.com" />
<option label="Microsoft" value="http://www.microsoft.com" />
</datalist>


2.4 The

pattern attribute
The pattern attribute specifies the pattern used to validate the input field. Patterns are regular expressions.
Note: The pattern attribute applies to the following types of <input> tags: text, search, url, telephone, email and password.
 
   Country code: <input type="text" name="country_code" pattern="[A-z]{3}"     title="Three letter country code" />


2.5
placeholder attribute: default value
The placeholder attribute provides a hint (hint) describing the expected value of the input field.
Note: The placeholder attribute applies to the following types of <input> tags: text, search, url, telephone, email and password.
<input type="search" name="user_search"  placeholder=请输入值" />


2.6

required attribute
The required attribute specifies that the input field must be filled in before submission (cannot be empty).
Note: The required attribute applies to the following types of <input> tags: text, search, url, telephone, email, password, date pickers, number, checkbox, radio and file.
Name: <input type="text" name="usr_name" required="required" />


3 New tags in HTML5.
     3.1 <abbr> Define abbreviations. Move the mouse to PRC and there will be abbr prompt
   The <abbr title="People's Republic of China">PRC</abbr> was founded in 1949.


  3.2 The bdo element can override the default text direction. rtl left to right, rtl right to left

<bdo dir="rtl">Here is some text</bdo>: display Here is some Hebrew text
<bdo dir="rtl">Here is some text</bdo>: display Here is some Hebrew text

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326942193&siteId=291194637