Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
167
rated 0 times [  173] [ 6]  / answers: 1 / hits: 191211  / 11 Years ago, sat, april 13, 2013, 12:00:00

How can I implement a select-style drop down menu in HTML with an option that is a text input?



The idea being that someone can either select from a list of predefined options, or input their own option.


More From » jquery

 Answers
13

You can use input text with list attribute, which refers to the datalist of values.





<input type=text name=city list=cityname>
<datalist id=cityname>
<option value=Boston>
<option value=Cambridge>
</datalist>





This creates a free text input field that also has a drop-down to select predefined choices. Attribution for example and more information: https://www.w3.org/wiki/HTML/Elements/datalist


[#78931] Friday, April 12, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dakotahs

Total Points: 605
Total Questions: 104
Total Answers: 113

Location: Hungary
Member since Wed, Nov 9, 2022
2 Years ago
;