Thread: combobox output
View Single Post
Old 01-04-2013, 04:48 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
What image do you intend to display if someone enters a value into the combo box that doesn't have a corresponding image - or did you mean a select list rather than a combo box.

Combo Box (where someone can select an option from the list or type their own):

Code:
<input type="text" list="fruit">
<datalist id="fruit">
<option value="Red Apple">Red Apple</option>
<option value="Green Apple">Green Apple</option>
</datalist>
Select List:

Code:
<select>
<option value="Red Apple">Red Apple</option>
<option value="Green Apple">Green Apple</option>
</select>
Two completely different field types (although Andrew's JavaScript would work for both apart from needing an extra else for a combobox to cater for when the person enters "Purple Pears" or "Yellow Bananas" or "qwertyuiop".
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote