Dev*_*esk 2 javascript jquery jsp
我有以下代码我想删除tbl-content
类如果recordList
数组为空
<table id="gradient-style">
<tbody class="tbl-content">
<tr>
<%
for (RecordBean record : recordList) {
// some code here to get result
}
%>
<%
if (recordList.isEmpty())
{
%>
<tr>
<td colspan="12" align="center" style="color: red;font-family: verdana">
<h3>No Search records </h3>
</td>
</tr>
<%
}
%>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
这是css
.tbl-content{
height: 650px;;
overflow: auto;
position: absolute;
border: 1px solid gray;
border-top: none;
}
Run Code Online (Sandbox Code Playgroud)
试试这个服务器端内联代码
<tbody class="<%= recordList.isEmpty()?"":"tbl-content" %>">
Run Code Online (Sandbox Code Playgroud)