我一直致力于 VB ASP.NET 网站,Visual Studio 2012 Express for Web。我有一个带有两个 div 标签和 css 类 .dnnFormLabel 和 .dnnFormItem 的 Repeater。这是 Repeater 中的部分代码:
<div class="dnnFormLabel dnnFormShort">
<asp:CheckBox runat="server" ID="chkSubQuestionBox" Text='<%#Eval("Label")%>' />
</div>
<div class="dnnFormItem dnnFormShort">
<div>
<label><span>
<asp:Label ID="lblSubQuestionLabel" runat="server"><%#Eval("Prefix")%> <%#Eval("Label")%></asp:Label></span></label></div>
<asp:TextBox runat="server" TextMode="MultiLine" ID="txtSubQuestionBox"></asp:TextBox>
<%#Eval("description")%>
</div>
我想在类 .dnnFormItem 没有任何内容时隐藏 div。为此,我尝试了:
.dnnFormItem:empty {
display: none !important;
}
但它不起作用。我怎样才能做到这一点?提前感谢您的帮助。
最佳答案
div里面不能有任何东西(包括\n),比如:
<div class="dnnFormItem dnnFormShort"></div>
然后.dnnFormItem:empty can tank效果
<div class="dnnFormItem dnnFormShort">
</div>
不会工作
关于jquery - 如何在 Repeater 中隐藏一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40645511/