HTML Field Validation

Source: Internet
Author: User

(1) Connect remove underline: style= "Text-decoration:none"

style= "Text-decoration:none"> This is a link! </a>

(2) text box input when prompted to enter the content: autocomplete= "On", do not prompt: autocomplete= "off"

AutoComplete should protect user-sensitive data against unsafe storage by local browsers.

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >autocomplete= "on" autocomplete= "Off" /><br/><input type= "Submit"/></form></body>

(3) text box prompt message: placeholder= "prompt Message"

Display descriptive descriptive text or informational messages to the user

placeholder= "Please enter your name" /></p></body>

(4) provides selectable list contents for input controls: list,datalist

Control property list= "Datalist.id"

<datalist>

<option lable= "xxxx" value= "xxxxxx"/>

......

</datalist>

list= "url_list" name= "link" style= "width:250px"/><DataList id= "url_list ">    <option label=" W3school "value=" http://www.w3school.com.cn "/> <option    label="Google "value="http://www.google.com"/>    <option label=" Microsoft "value="/HTTP/ www.microsoft.com "/></datalist></body>

(5) Required fields verification: required:required="required"

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >formrequired= "required" /><input type= "Submit" value= "commit"/></  Form></body>

(6) Regular match: pattern= "Regular expression"

pattern= "[A-z]{3}" title= "Please enter the three-letter city Code" /><input type= "Submit" value= "Submit"/></form></ Body>

(7) Email verification: type="Email"

type= "Email " name= "email" required= "required"/><input type= "Submit" value= "Submit"/></form> </body>

(8) field length limit: min= "", max= ""

min= "0" max= " required=" required "/><input type=" Submit "value=" Submit "/></form></body >

(9) Verify that two times the password is consistent: Customerror

This need to use the knowledge of JS, follow-up supplement

(10) text box can only enter numeric value: type= "Number"

A single digital validation input can be typed, but if it is other combinations of allowable input numbers and letters, you need to use regular expressions to qualify

type= "number" id= "number" name= "number" min= "6" max= "8" required= "required"/><input type= "Submit" Value= "Submit"/></form></body>

HTML Field Validation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.