简体   繁体   English

HTML输入标签功能+选择标签功能?

[英]HTML input tag function + select tag function?

My Question 我的问题

I searched to figure out my question but I couldn't figure out. 我搜寻了一下我的问题,但找不到。

I wonder if it is any way to build select which you even can write like input(type=text). 我想知道是否有任何方法可以建立select甚至可以像input(type = text)这样编写的select。 For example, You can select one option from select list or you can write on it without selecting any. 例如,您可以从选择列表中选择一个选项,也可以不选择任何选项而在其上书写。

I want to mix functions of two below in one input . 我想在一个输入中混合下面两个函数。

<select>
    <option value=1>A</option>
    <option value=2>B</option>
</select>

<input type="text">

you can select A or B by select function but if you don't find what you want from select, you can write for example C instead. 您可以通过选择功能选择A或B,但是如果找不到要选择的内容,则可以编写例如C。


Conclusion 结论

I could find refereces for my question when I search with keyword "html combo" My problem was I tried to find with wrong keyword! 当我用关键字“ html combo”搜索时,我可以为我的问题找到裁判。我的问题是我试图用错误的关键字找到!

simiply, (I mixed HTML5 syntax and HTML4 syntax, i think) 简单地说,(我认为我混合了HTML5语法和HTML4语法)

<input type="text" list="test">
<datalist id="test">
    <option>Hello</option>
    <option>world!</option>
</datalist>

Then this is the answer 那就是答案

 <input type="text" list="test"> <datalist id="test"> <option>Hello</option> <option>world!</option> </datalist> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM