I was trying to insert images in a drop down list. I tried the following code but its not working. What is the best way to achieve this?
<select>
<option value="volvo"><IMG src="a.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Volvo</option>
<option value="saab"><IMG src="b.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Saab</option>
<option value="mercedes"><IMG src="c.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Mercedes</option>
<option value="audi"><IMG src="d.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Audi</option>
</select>
Well if you are ready to use a Javascript framework called DHTMLX, they have a component called dhtmlxCombo which allows you to do this.There is an opensource version and the sample code with the output you are looking for is given in the link below
dhtmlxCombo with Images in options
This is exactly what you need. See it in action here 8FydL/445
Example's Code below:
CSS:
JS:
and Demo Html: