HTML datalist tag
- 24-07-2022
- Trung Minh
- 0 Comments
The <datalist> tag specifies a predefined list of options for an <input> element.
The <datalist> tag is used to provide "autocomplete" functionality for <input> elements, users will see a drop-down list of options before they enter data.
Use the list attribute of the <input> tag in combination with the id attribute of the <datalist> tag for binding.
How to use the <datalist> . tag
Example : Use the <datalist> tag to create a pre-option list for the input tag.
<!DOCTYPE html> <html> <head> <title>Học lập trình miễn phí tại web888.vn</title> <meta charset="utf-8"> </head> <body> <h1>Học lập trình miễn phí tại web888.vn</h1> <form action="/action_page.php" method="get"> <input list="browsers" name="browser"> <datalist id="browsers"> <option value="Internet Explorer"> <option value="Firefox"> <option value="Chrome"> <option value="Opera"> <option value="Safari"> </datalist> <input type="submit"> </form> </body> </html>
Attribute of <datalist> . tag
The <datalist> tag is provided with all the Global Attributes in HTML.