📌  相关文章
📜  之间的区别<datalist>&<select> HTML中的标签

📅  最后修改于: 2022-05-13 01:56:34.819000             🧑  作者: Mango

HTML 中 标签。通常,这两个标签都用于从给定列表中选择一个选项。但两者之间的主要区别在于,在 标记中,用户可以输入自己的输入并在 元素的帮助下将其添加为选项,而 元素的预定义选项。此标记还为 HTML 的 元素提供了自动完成功能。就像一旦用户开始输入 标签的输入元素,用户将看到以用户输入的字母或单词开头的预定义选项。请注意,要使用 标签,标签的 id 必须与 元素属性的 id 相同。

句法:


   

例子:

HTML


  

    

GeeksforGeeks

    

Using Datalist

                                             

        User can choose an option from a          given options
and also give          an input and filter values from          the option list.     

  


HTML


  

    

GeeksforGeeks

    

Using Select

                           

        User has to choose any          one option from a list.     

  


输出:

HTML 标记包含

句法:



例子:

HTML



  

    

GeeksforGeeks

    

Using Select

                           

        User has to choose any          one option from a list.     

  

输出:

tag

tag

The user can choose only one option from the given list.The user can choose any option from the given list but can also use its own input.This tag is a form input type.This tag is not a form input type.The user has to scan a long list so as to select an option. The user can easily input the option and get the hints and then can be chosen by the user.The user can be restricted to a list of options.The user is not restricted by the list of options.It doesn’t provide the auto-complete feature.It provides the auto-complete feature.