セレクトコンボ「#accountSelector」でCODE!=「abc012345」のアイテムを青にしたい。
次の解決策を試してみましたが、正しく動作しますが、コードの複製があります (" option " タグの内容が IF ELSE ステートメントに複製されます)。
コードの複製を避けるために、オプション タグの色を変更するにはどうすればよいですか? javascript/jquery クリーナー ソリューションはありますか?
<table border="0" cellPadding="0" cellSpacing="0" >
<logic:notEmpty name="enabledReportsList" >
<tr>
<td>
<select id="accountSelector" name="accountSelector" style="WIDTH: 380px" class="comboFilter" onChange="preSubmit();document.changeReports.submit()">
<logic:iterate id="cc" indexId="ccn" name="enabledReportsList" >
<% if (!( ((it.myproject.common.Report)cc).getCode() ).equals("abc012345")){%>
<option style="color:blue" value="<bean:write name="cc" property="Report"/>" <%= ( ((it.myproject.common.Report)cc).getReport() ).equals(session.getAttribute("accountSelector")) ? "selected" : "" %> >
<bean:write name="cc" property="fullValue"/>
</option>
<%} else {%>
<option value="<bean:write name="cc" property="Report"/>" <%= ( ((it.myproject.common.Report)cc).getReport() ).equals(session.getAttribute("accountSelector")) ? "selected" : "" %>>
<bean:write name="cc" property="fullValue"/>
</option>
<%}%>
</logic:iterate>
</select>
</td>
<td class="filterheader">
<b><bean:message key="selector.account" arg0="${fn:length(enabledReportsList)}"/></b>
</td>
</tr>
</logic:notEmpty>
<logic:empty name="enabledReportsList" >
<tr>
<td class="filterheader">
<bean:message key="ENABLED_REPORTS.combo.empty"/>
</td>
</tr>
</logic:empty>
</table>