I need to add an input type image on a select. There’s no drop down just a scroll bar. I want to image to appear when an option is selected and then remove it when not selected. It’s more like a want than a need though…Hahaha
For example:
I have this select tag..
<select id="myselect">
<option value=1>TEXT ONE</option>
<option value=2>TEXT TWO</option>
</select>
I want to be like this when I select one of the two options..
<select id="myselect">
<option value=1><input type=image src="blah.png"/>TEXT ONE</option>
<option value=2>TEXT TWO</option>
</select>
Then goes back to the original when not selected, not focused or nothing is selected at all..
<select id="myselect">
<option value=1>TEXT ONE</option>
<option value=2>TEXT TWO</option>
</select>
Sorry for the confusion.
I don’t believe you can nest input tags as such. What you could do is determine which one is selected with javascript and then add a class to the option tag which would then display an image in the background of the tag. You could use the
onChange="myfunction()"attribute to fire a function when the options are changed. But I don’t believe that all versions of IE support the background on an option tag.