Announcement Announcement Module
Collapse
No announcement yet.
Independently styling each item of a select list? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Independently styling each item of a select list?

    I'm using Spring's form:select JSP tag to generate an HTML select tag (i.e. a drop-down). How can I style each item in that list independently? For example, the items being listed have an "active" property. I want to apply a specific CSS style to the items in the list that have active = false.

  • #2
    Code:
    <form:select path="myList">
    	<c:forEach items="${formModel.listTypes}" var="option">
    		<form:option value="${option}" cssClass="${option.active? 'on': 'off'}"><fmt:message key="${option}" /></form:option>
    	</c:forEach>
    </form:select>

    Comment


    • #3
      Thanks, I'll try it out and let you know how it goes.

      Comment

      Working...
      X