Article introduction of Wulin.com (www.vevb.com): HTML5 tutorial: Form form automatic verification.
1. required attribute:
<form>
<input id=webjx_required name=webjx.com required type=text/>
<input type=submit value=submit/
</form>
The required attribute can be used on most input elements (except hidden elements, image element buttons, etc.).
The required property indicates that this input box is a required item. When submitting, if this input box is empty, the user will be prompted to enter and submit.
<form>
<input id=webjx_required name=webjx.com required type=text/>
<input type=submit value=submit/
< /form>
2. Pattern attribute:
<form>
<input id=webjx_pattern name=webjx.com required pattern=/d{3} type=text/
<input type=submit value=submit/
</form>
The value of the pattern attribute is generally a regular expression. Only when the content entered by the user meets a certain format can it be submitted. Otherwise, the user will be prompted to not meet the requirements. As shown above, 3 digits must be entered.
Run now:
< form>
<input id=webjx_pattern name=webjx.com required pattern=/d{3} type=text/
<input type=submit value=submit/
< /form>
3. Min attribute and max attribute:
<form>
<input id=webjx_min_max name=webjx.com required min=3 max=16 type=number/>
<input type=submit value=submit/
</form>
The two attributes min and max are proprietary attributes of the input element of the numeric type or date type. They limit the range of values and dates entered in the input element. The attribute value is a number.
Run now:
< form>
<input id=webjx_min_max name=webjx.com required min=3 max=16 type=number/>
<input type=submit value=submit/
< /form>
4. Step attribute:
<form>
<input id=webjx_step name=webjx.com required step=10 min=0 max=100 type=number/>
<input type=submit value=submit/
</form>
The step attribute controls the increase or decrease of the input element's value. For example, when you want the user to enter a value between 0-100, but it must be a multiple of 10, as shown in the above code, click below to run to see the effect.
Run now:
< form>
<input id=webjx_step name=webjx.com required step=10 min=0 max=100 type=number/>
<input type=submit value=submit/
< /form>