Compared with HTML4, the elements and features in HTML5 provide a greater degree of semantic markup, and also remove a large number of redundant elements that exist in HTML4 due to scripts and styles. By making forms behave more consistently on different websites and responding to user input data in a timely manner, HTML5 form features provide users with a better experience. These experiences also apply to users who have disabled browser scripting.
This topic describes some new features or changes that are supported by Gecko/Firefox4 or higher.
The type attribute of element
has more values.
search: This element renders a search box. Newlines are removed from the input value, but there are no other syntax enhancements.
tel: This element can be used as an input control for editing phone numbers. Newlines are removed from the input value, and no other syntax enhancements are made because phone number internationalization differences are very obvious. You can use properties such as pattern and maxlength to limit the values entered into the control.
url: This element is rendered as an input control for editing a URL. Newlines and leading and trailing spaces will be automatically removed.
email: This element is rendered as an email address. Line breaks are automatically removed. It is possible to set an invalid email address, but if it meets the constraints of the input box, it must comply with the specifications in Extended Backus Normal Form (ABNF): 1( atext / "." ) "@" ldh-str 1( "." ldh-str ) where atext is defined in RFC 5322 section 3.2.3 and ldh-str is defined in RFC 1034 section 3.5. .
Note: If the multiple attribute is set, multiple emails can be entered in the area separated by commas, but Firefox does not support it. The element also has some new features.
list: The ID of the
pattern: A regular expression used to check the value of a control, which can be applied to input elements whose type values are text, tel, search, url, and email.
form: A string indicating which