Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i put an image into select? [duplicate]

i have this script

<select>
<option value="1">one<img src="star.gif" height="15" width="15"></img> </option>
</select>

but it doesn't work. how can i put an image into select? thanks

update:

so it's impossible?:(maybe via javascript?...

like image 785
Simon Avatar asked Mar 26 '10 16:03

Simon


2 Answers

you can't - DOM model doesn't allow img elements inside option elements

like image 197
plodder Avatar answered Oct 13 '22 18:10

plodder


Most website which associate images with a certain option in a menu use JavaScript or jQuery to change an image at the left or right of the menu whenever a new option is selected. However, it is not possible in any way to put an image inside or set a background image for an option element.

like image 30
animuson Avatar answered Oct 13 '22 17:10

animuson