Welcome 🎉

logo

ReactLMS

Search
Light Mode
Contact Us

2 min to read

Contact us

No results for your search.
Sorry, an unexpected error occurred

Concept


Tag <datalist> is a new HTML tag introduced in HTML5. It is used to create a list of options for an input field.


How to use


Syntax

<input list="ten-danh-sach">
<datalist id="ten-danh-sach">
  <option value="tuy-chon-1">
  <option value="tuy-chon-2">
  <option value="tuy-chon-3">
  <!--Thêm các tùy chọn khác nếu cần-->
</datalist>






Where:

Example

<label for="fruit">Chọn một loại trái cây:</label>
<input list="fruit" id="fruit-input">
<datalist id="fruit">
  <option value="Táo">
  <option value="Cam">
  <option value="Chuối">
  <option value="Dứa">
  <option value="Dưa hấu">
</datalist>






Result

In the example, when the user enters the input field, they will receive suggestions from the fruit list.


Read more
On This Page