HTML5 datalist-Auto-matching form input

Source: Internet
Author: User
DataList is the new label for HTML5, which is used to automatically match the possible input of the form

DataList the user may enter the value, placed in the option list, when the user in the corresponding form input, according to the input keyword automatically match the contents of the option list, you can also enter the option does not exist in the value. Use the following

<input list= "Browsers" name= "browser" >//the list property of the form specifies the corresponding DataList <datalist id=
"Browsers" >   // Also DataList must be ID must be the same as the list property of the form
  <option value= "Internet Explorer" >
  <option value= "Firefox" >
  <option value= "Chrome" >
  <option value= "Opera" >
  <option value= "Safari" >
</ Datalist>

The value is displayed when we enter a keyword that matches the value of the option selected under DataList.
As shown in the following figure

If you enter a keyword that matches the option number, then each match will show

  <datalist id= "Browsers" >   //At the same time DataList must ID must be the same as the list property of the form
  <option value= "Internet Explorer" >
  <option value= "Firefox" >
  <option value= "Chrome" >
  <option value= "Opera" >
  < Option value= "FDSDD" >
  <option value= "defed" >
  <option value= "Safari" >
</datalist>

exception, that little triangle is automatically displayed only when the form gets the focus

Browsers that are not supported
Internet Explorer 9 (earlier IE version), Safari does not support DataList tags

Related Article

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.