I am able to create a simple drop down menu, but i want get ahead i am trying to apply background color to each option in select tag and value to for it.
<select> <option value = "01" style="background-color:red;"> Town hall Station </option> <option value = "02" style="background-color:blue;"> central Station </option> <option value = "03" style="background-color:yellow;"> auburn Station </option> </select>
xml file
<routes> <route id = 01> <name>Town hall station</name> <color>red</color> </route>
<route id = 02> <name>central station</name> <color>blue</color> </route>
<route id = 03> <name>auburn station</name> <color>yellow</color> </route> </routes>
You'll need something like this where 1010 is the node id of your 'Routes' node (there are many different ways to get this node value but for now this should get you started
(Not tested)
<select>
<xsl:for-each select="umbraco.library:GetXmlNodeById(1010)/* [@isDoc and string(umbracoNaviHide) != '1']">
create drop down menu in xslt
I am able to create a simple drop down menu, but i want get ahead i am trying to apply background color to each option in select tag and value to for it.
please if anyone has solution post me.
regards
Aaron
Hi Aaron,
Welcome to the Umbraco forum!
You'll need something like this where 1010 is the node id of your 'Routes' node (there are many different ways to get this node value but for now this should get you started
(Not tested)
<select>
<xsl:for-each select="umbraco.library:GetXmlNodeById(1010)/* [@isDoc and string(umbracoNaviHide) != '1']">
<option value="{id}" style="background-color:{color};">
<xsl:value-of select="@nodeName"/>
</option>
</xsl:for-each>
</select>
Rich
Hi. Also, afaik, styling a separate options of a 'select' element doesn't work as expected in different browsers.
Rodion
Thank you that should help.
regards
Aaron
is working on a reply...