The best HTML5 Form Properties Tutorial In 2024, In this tutorial you can learn HTML5 New Form Properties,<Form> / <input> autocomplete attribute,Examples,<Form> novalidate property,Examples,<Input> autofocus attribute,Examples,<Input> form property,Examples,<Input> formaction property,Examples,<Input> formenctype property,Examples,<Input> formmethod property,Examples,<Input> formnovalidate property,Examples,<Input> formtarget property,Examples,<Input> height and width attributes,Examples,<Input> list properties,Examples,<Input> min and max attributes,Examples,<Input> multiple properties,Examples,<Input> pattern property,Examples,<Input> placeholder attribute,Examples,<Input> required Attribute,Examples,<Input> step attributes,Examples,HTML5 <input> tag,
HTML5's <form> and <input> tag adds several new properties.
<Form> new attributes:
<Input> New properties:
autocomplete attribute specifies the form or input field should have autocomplete.
When users start typing in the autocomplete field, the browser should display options to fill in this field.
Tip: autocomplete attribute possible form element is turned on, and in the input element is turned off.
Note: autocomplete apply <form> tag, and the following types of <input> tag: text, search, url, telephone , email, password, datepickers, range and color.
HTML form in open autocomplete (a shutdown input field autocomplete):
Tip: Some browsers, you may need to enable the AutoComplete feature, in order to pick up the property.
A boolean property novalidate property.
novalidate attribute specifies when submitting the form should not validate form input or domain.
Without verification form data submission
autofocus attribute is a boolean attribute.
autofocus attribute specifies when the page loads, the domain automatically receive focus.
Let "First name" input field enter the auto focus on page load:
attribute specifies a form input field belongs to one or more forms.
Tip: To cite more than one form, use a space-separated list.
Located in form form outside the input field refers to HTML form (the form is still a form input forms part of):
The formaction property is used to describe the URL of form submission.
The formaction attributes override <form> element in the action attribute.
Note: The formaction attribute type = "submit" and type = "image".
HTMLform submit the following form contains two different addresses button:
formenctype attribute describes the form is submitted to the server data encoding (only for form form method = "post" form)
formenctype property overrides enctype attribute form elements.
Main: This attribute type = "submit" and type = "image" used in conjunction.
The first submit button to send the form data is encoded by default, the second submit button to "multipart / form-data" encoding format to send the form data:
formmethod attribute defines the way form submission.
formmethod property covering the <form> element's method attribute.
Note: This attribute can be used with type = "submit" and type = "image" used in conjunction.
Redefine the form submission by way of example:
novalidate property is a boolean property.
novalidate attribute describes the <input> elements do not need to be validated when the form is submitted.
formnovalidate attributes override novalidate attribute <form> element.
Note: formnovalidate attribute type = "submit for use with
Two buttons submit the form (not applicable with verification):
formtarget attribute specifies a name or a keyword to indicate the display data received after the form is submitted.
The formtarget property overrides <form> target attribute of the element.
Note: formtarget attribute type = "submit" and type = "image" used in conjunction.
Two buttons submit the form displayed in different windows:
height and width attributes specified for the image type of <input> tag image height and width.
Note: height and width properties only apply to image type <input> tag.
Tip: The image will usually specify the height and width attributes.If the image set the height and width of the space required for the image when the page is loaded will be retained. Without these attributes, the browser does not know the size of the image, and can not set aside the appropriate space. Photos during the loading process will effect change page layout (although image has loaded).
Defines an image submit button, use the height and width attributes:
datalist list attribute specifies the input fields. datalist is a list of options for the input fields.
Predefined in <datalist> in <input> value:
min, max, and step attributes are used as input types containing numbers or dates Limited (constraints).
Note: min, max, and step attributes apply to the following types of <input> tag: date pickers, number and range.
<Input> elements of the minimum and maximum settings:
multiple attribute is a boolean attribute.
multiple attribute specifies <input> element to select multiple values.
Note: multiple properties apply to the following types of <input> tag: email and file:
Upload multiple files:
pattern attribute describes a regular expression used to validate the value of <input> elements.
Note: pattern attribute applies to the following types of <input> tag: text, search, url, tel , email, and password.
Tip: It is used for the global title attribute describes the mode.
Tip: You can in our JavaScript tutorial to learn about the content of a regular expression
The following example shows a three letters contain only text field (no numbers or special characters):
placeholder attribute provides a hint (hint), describe the expected value of the input field.
A brief reminder will be displayed on the input field before the user input value.
Note: placeholder attribute applies to the following types of <input> tag: text, search, url, telephone , email and password.
input field prompt text t:
required attribute is a boolean attribute.
required attribute specifies that an input field must be filled (not empty) before submitting.
Note: required attributes for the following types of <input> tag: text, search, url, telephone , email, password, date pickers, number, checkbox, radio and file.
Can not empty input fields:
step attribute for the input field specifies the legal number intervals.
If step = "3", legal numbers could be -3,0,3,6, etc
Tip: step attribute can create a regional value max and min attributes.
Note: step attribute types used in conjunction with the following type: number, range, date, datetime , datetime-local, month, time and week.
Predetermined input step step 3:
标签 | 描述 |
---|---|
<form> | 定义一个form表单 |
<input> | 定义一个 input 域 |