manipulating option text

admin

Administrator
Staff member
Is it possible to manipulate option text such that you could vary text properties (ie. font, color, etc.). I've been unsuccessfully trying to do this using a SPAN element within the text string. For example:<br />
<br />
<select id=systemID name=systemID style="width:90%; font-family:Arial; font-size:12px; font-weight:normal"><br />
<option value="12345">Hello <span id="optionID" style="color:red; font-size:16px"> W</span>orld </option><br />
</select><br />
<br />
An IE6 browser disregards the span element when it is embedded in the text of the option tag. Using span tags doesn't seem to work. The span element is suppose to give structure and context to any inline content in a document. It doesn't seem to work for content within option tags. <br />
<br />
Am I employing span improperly for this case? Are there any workarounds to enable manipulation of option text.<!--content-->You can not use spans inside <option> tags like that... The best you can do is change the entire text for the option tag:<br />
<br />
<select id="systemID" name="systemID" style="width:90%; font-family:Arial, sans-serif; font-size:12px; font-weight:normal"> <br />
<option value="12345" style="color:red; background-color: white;">Hello World </option> <br />
</select><!--content-->
 
Back
Top