Home > Article > Web Front-end > How to use the Datalist element tag in HTML5
HTML5 Tutorial"
Below we will introduce it to you through specific code examples.<!DOCTYPE> <html> <meta charset="utf-8"> <head> <title>Datalist元素使用示例</title> </head> <body> <input name="section" list="scripts" /> <datalist id="scripts"> <option value="PHP" /> <option value="JavaScript" /> <option value="java" /> <option value="Go" /> <option value="python" /> <option value="c++" /> </datalist> </body> </html>The effect is as shown below: #It has an auto-complete function to help users enter content in the text box, with a drop-down list box or radio button Differently, the user can write any text without being restricted by the options given by datalist. Datalist is bound (or linked) via the input element list attribute. Note: fc86e7b705049fc9d4fccc89a2e80ee3 tag defines the option list. Use this element in conjunction with an input element to define the possible values of the input. The datalist and its options are not displayed, it is just a list of legal input values. You need to use the list attribute of the input element to bind the datalist. This article is an introduction to the usage of the Datalist element in HTML5. It is simple and easy to understand. I hope it will be helpful to friends in need!
The above is the detailed content of How to use the Datalist element tag in HTML5. For more information, please follow other related articles on the PHP Chinese website!