HTML5 form properties
HTML5's
A boolean attribute of the novalidate attribute. The novalidate attribute specifies that the form or input field should not be validated when submitting the form.
Instance
php中文网(php.cn)
注意在 Safari 和 Internet Explorer 9 及之前的版本中不支持 novalidate 属性。
Click the "Run instance" button to view the online instance
The autofocus attribute is a boolean attribute. The autofocus attribute specifies that the field automatically gains focus when the page is loaded.
Instance
php中文网(php.cn)
Last name:
注意: Internet Explorer 9及更早IE版本不支持input标签的 autofocus 属性。
Click the "Run instance" button to view the online instance
The form attribute specifies one or more forms to which the input field belongs.
Tip:
If you need to reference more than one form, please use a space-separated list.
Example
php中文网(php.cn)
"Last name" 字段没有在form表单之内,但它也是form表单的一部分。
Last name:注意: IE不支持form属性
Run instance»
Click the "Run instance" button to view the online instance
formaction attribute
The formaction The attribute is used to describe the URL address for form submission.
The formaction attribute will override the action attribute in the
Note:The formaction attribute is used to type="submit" and type="image".
## formenctype attribute formenctype attribute describes the data encoding of the form submitted to the server (only for form forms method="post" form) The formenctype attribute overrides the enctype attribute of the form element.
Main:This attribute is used with type="submit" and type="image".
php中文网(php.cn)
注意: Internet Explorer 9及更早IE版本不支持input标签的 formenctype 属性。
Run Instance» Click the "Run Instance" button to view the online instance
formmethod attribute The formmethod attribute defines how the form is submitted. The formmethod attribute overrides the method attribute of the
Note:This attribute can be used with type="submit" and type="image".
php中文网(php.cn)
Last name:
注意: Internet Explorer 9及更早IE版本不支持input标签的 formmethod 属性。
Run Instance» Click the "Run Instance" button to view the online instance
formnovalidate attribute The novalidate attribute is a boolean attribute. The novalidate attribute describes that the element does not need to be verified when the form is submitted. The formnovalidate attribute will override the novalidate attribute of the
Note:The formnovalidate attribute is used together with type="submit
php中文网(php.cn)
注意: Internet Explorer 9及更早IE版本,或Safari不支持input标签的 formnovalidate 属性。
Run instance» Click the "Run instance" button to view the online instance
# # formtarget attribute
The formtarget attribute specifies a name or a keyword to indicate the display of form submission data after it is received.
The formtarget attribute overrides the target attribute of the
The formtarget attribute is used with type="submit" and type="image".
Example php中文网(php.cn)
Last name:
注意: Internet Explorer 9及更早IE版本不支持input标签的 formtarget 属性。
Run instance»
Click the "Run instance" button to view the online instance
## height and width attributes The height and width attributes specify the image height and width used for tags of type image.
Note:The height and width attributes are only applicable to tags of image type.
Tip:Images usually specify both height and width attributes. If the image sets height and width, the space required by the image Will be retained when loading the page. Without these properties, The browser does not know the size of the image and cannot reserve it Proper space. The image will change the page layout effect during the loading process (Though the image is loaded).
php中文网(php.cn)
Last name:
Run Instance» Click the "Run Instance" button to view the online instance
list attribute list attribute specifies the datalist of the input field. datalist is a list of options for the input field.
php中文网(php.cn)
注意: Internet Explorer 9(更早IE版本),Safari不支持 datalist 标签。
Run Instance» Click the "Run Instance" button to view the online instance
min and max attributes The min, max, and step attributes are used to specify limits (constraints) for input types that contain numbers or dates.
Note:The min, max, and step attributes apply to the following types of tags: date pickers, number, and range.
php中文网(php.cn)
输入 2000-01-01 之后的日期:
数量 (在1和5之间):
注意: Internet Explorer 9及更早IE版本,Firefox不支持input标签的 max 和 min 属性。
注意: 在Internet Explorer 10中max 和 min属性不支持输入日期和时间,IE 10 不支持这些输入类型。
Run Instance» Click the "Run Instance" button to view the online instance
multiple attribute The multiple attribute is a boolean attribute. The multiple attribute specifies that multiple values can be selected in the element.
Note:The multiple attribute applies to the following types of tags: email and file. : email, and file.
php中文网(php.cn)
尝试选取一张或者多种图片。
注意: Internet Explorer 9及更早IE版本不支持input标签的 multiple 属性。
Run Instance» Click the "Run Instance" button to view the online instance
pattern attribute
The pattern attribute describes a regular expression used to validate the value of the element.
Note:The pattern attribute applies to the following types of tags: text, search, url, tel, email, and password.
Tips :is used for the global title attribute to describe the pattern.
Tips:You can learn about regular expressions in our JavaScript tutorial
placeholder attribute
The placeholder attribute provides a hint describing the value expected by the input field.
A brief prompt will be displayed on the input field before the user enters a value.
Note:The placeholder attribute applies to the following types of tags: text, search, url, telephone, email and password.
required attribute
The required attribute is a boolean 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 tags: text, search, url, telephone, email, password, date pickers, number, checkbox, radio and file.
step attribute
The step attribute specifies the legal number interval for the input field.
If step="3", the legal numbers are -3,0,3,6, etc.
Tips:The step attribute can be used with The max and min attributes create a range value.
Note:The step attribute is used with the following types: number, range, date, datetime, datetime-local, month, time and week.
HTML5 Tags
Description | |
---|---|
Define a form | |
Define an input field |