Comment: This article mainly introduces the html5 datalist tag usage example (automatically complete component). Friends who need it can refer to it
In the past, I needed to write an automatic completion component (Suggest) in JS, which was very difficult. In the HTML5 era, it is no longer necessary. It uses datalist tags directly, which directly reduces the workload. as follows
<!DOCTYPE html>
<html>
<head>
<title>HTML5 datalist tag</title>
<meta charset="utf-8">
</head>
<p>
Browser version: <input list="words">
</p>
<datalist>
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
<option value="Sogou">
<option value="Maxthon">
</datalist>
</body>
</html>
Datalist provides a pre-defined list, which is associated with input through id. When input is entered in input, there will be an automatic completion function, and the user will see a drop-down list for it to choose.
Chrome/Firefox/Opera and IE10+ are supported, and Safari is still not supported until version 7.