简体   繁体   中英

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). 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.


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!

simiply, (I mixed HTML5 syntax and HTML4 syntax, i think)

<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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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