Home > Web Front-end > H5 Tutorial > How to use the Datalist element tag in HTML5

How to use the Datalist element tag in HTML5

藏色散人
Release: 2018-12-05 09:43:37
Original
5667 people have browsed it



## tag is a new tag in HTML 5. This element is used in forms to retrieve data from the user. Receiving data, it can display options for the user to select.

How to use the Datalist element tag in HTML5

Recommended study: "

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>
Copy after login

The effect is as shown below:

How to use the Datalist element tag in HTML5

#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:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template