HTML new form attributes

HTML new form attributes

HTML5's

and tags add several new attributes.

New attributes:

autocomplete

novalidate

New attribute:

autocomplete

autofocus

form

formaction

formenctype

formmethod

formnovalidate

formtarget

height and width

list

min and max

multiple

pattern (regexp)

placeholder

required

step

/ autocomplete attribute

The autocomplete attribute specifies that the form or input field should have the autocomplete function.

When the user starts typing in an autocomplete field, the browser should display the filled-in options in that field.

Tip: The autocomplete attribute may be turned on in the form element and turned off in the input element.

Note: autocomplete applies to the tag, as well as the following types of tags: text, search, url, telephone, email, password, datepickers, range and color.

novalidate attribute

A boolean attribute of the novalidate attribute.

The novalidate attribute specifies when submitting the form Form or input fields should not be validated.

autofocus attribute

The autofocus attribute is a boolean attribute.

The autofocus attribute specifies when the page is loaded , the domain automatically gets focus.

form attribute

The form attribute specifies one or more forms to which the input field belongs.

Tip: If you need to reference more than one form, use a space-separated list.

formaction attribute

The formaction attribute is used to describe the URL address of form submission.

The formaction The attribute will override the action attribute in the element.

Note: The formaction attribute is used for type="submit" and type="image".

formenctype attribute

formenctype attribute describes the data encoding of the form submitted to the server (only for the method="post" form in the form form)

formenctype attribute Override the enctype attribute of the form element.

Mainly: This attribute is used in conjunction with type="submit" and type="image".

formmethod attribute

The formmethod attribute defines how the form is submitted.

The formmethod attribute overrides the method attribute of the element.

Note: This attribute can be used with type="submit" and type="image".

formnovalidate attribute

novalidate attribute is a boolean attribute.

novalidate attribute describes ; The element does not need to be validated on form submission.

The formnovalidate attribute will override the novalidate attribute of the element.

Note: The formnovalidate attribute is used with type="submit

formtarget attribute

The formtarget attribute specifies a name or a keyword to indicate the display after the form submission data is received.

The formtarget attribute overrides the target attribute of the element.

Note: The formtarget attribute is used with type="submit" and type="image".

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 an image has a height and width set, the space required by the image will be preserved when the page loads. Without these attributes, the browser does not know the size of the image and cannot reserve appropriate space. The image will cause the page layout effect to change during the loading process (even though the image has been loaded).

list attribute

list attribute specifies the datalist of the input field. datalist is a list of options for the input field.

min and max attributes

The min, max, and step attributes are used to specify limits for input types that contain numbers or dates. (constraint).

Note: The min, max, and step attributes apply to the following types of tags: date pickers, number, and range.

multiple attribute

The multiple attribute is a boolean attribute.

The multiple attribute stipulates that the element can Select multiple values.

Note: The multiple attribute applies to the following types of tags: email and file. : email, and file.

pattern attribute

pattern attribute describes a regular expression used to verify ; The value of the element.

Note: The pattern attribute applies to the following types of tags: text, search, url, tel, email, and password.

Tips: It is used to describe the global title attribute Mode.

placeholder attribute

The placeholder attribute provides a hint describing the expected value of 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

required attribute is a boolean attribute.

required attribute must be specified before submission Fill in the input fields (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 to create a range value.

Note: The step attribute is used with the following types: number, range, date, datetime, datetime-local, month, time and week.


below In the case, we have explained some commonly used attributes. You can directly look at the code and the comments next to the code, and then compare the running results of the browser to understand its meaning

   




选择文件

区号:






Continuing Learning
||




选择文件

区号:





submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!