Wednesday, 7 August 2013

how to place image tags in a select imput bar

how to place image tags in a select imput bar

i have a select box below that works perfectly; i however want to place a
little colour box in each of the option groups. i tried using a span tag
within it but it does not seem to work.
i don't want to use anchor tags or images. i would prefer if possible just
to have some kind of container tag.
i have enclosed my code below.
<select name="search-legend">
<option value=""></option>
<option value="1"<?= $this->ReturnSearchValue == "1" ? 'selected' :
'' ?>> <span id="redbox"> </span> value1 </option>
<option value="2"<?= $this->ReturnSearchValue == "2" ? 'selected' :
'' ?>> <span id="bluebox"></span> value2 </option>
<option value="3"<?= $this->ReturnSearchValue == "3" ? 'selected' :
'' ?>> <span id="greenbox"></span> value3 </option>
</select>
the css
#redbox {
background: red;
}

No comments:

Post a Comment