CSS:
<style>
body{font-family: arial; }
.nopad{padding-bottom:5px;}
.exBt:before {content: "[+]";float:left;padding-right:3px;}
.exBt_nobtn {height:12px;width:12px;float:left;padding-left:50px;}
</style>
查询:
<script>
jQuery(document).ready(function(){
jQuery(".nopad").each(function(){
if (jQuery(this).find('div').hasClass('.exBt'))
{
jQuery(this).find(".taskName").css('font-weight','bold');
jQuery(this).find(".taskName").css('font-size','16px');
}
});//end each
});//end main
</script>
HTML:
<div class="nopad">
<div class="exBt"></div>
<div class="taskName">This is a title</div>
</div>
<div class="nopad">
<div class="exBt_nobtn"></div>
<div class="taskName">this is subcontent</div>
</div>
<div class="nopad">
<div class="exBt_nobtn"></div>
<div class="taskName">this is subcontent</div>
</div>
这段代码工作正常。我只是希望它与此一起工作:
<div class="nopad${addDivClass}">
<c:choose>//tests if heading content has child content
<c:when test="${item.nestHead}">
//if it has content use one class(add a-+ icon)
<div class="extBt" id="extBt-${item.itemId}"></div>
</c:when>
<c:otherwise>
//if there is no child content loaded by ajax just indent with another class
<div class="extBt_nobtn" id="extBt-${item.itemId}"></div>
</c:otherwise>
</c:choose>
我对 JSTL Core 很陌生,但我认为那样做会更干净——我只是不知道怎么做