gpt4 book ai didi

jquery - 如果 tbody 中的所有单元格均为空,则隐藏表格

转载 作者:行者123 更新时间:2023-12-01 07:51:48 25 4
gpt4 key购买 nike

如果 tbody 中的所有单元格均为空,我希望能够隐藏整个表格。我只能找到如何隐藏单行(如果其中的所有单元格都是空的)。

这是代码。这是一个动态生成的表格,如果正文中没有内容,我想隐藏它:

<table class="acf-dynamic-table ">
<thead>
<tr>
<th>Headline 1</th>
<th>Headline 2</th>
<th>Headline 3</th>
<th>Headline 4</th>
<th>Headline 5</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

非常感谢您的帮助!

最佳答案

if ($.trim($('.acf-dynamic-table tbody').text())=="") {
$('.acf-dynamic-table').hide();
}

关于jquery - 如果 tbody 中的所有单元格均为空,则隐藏表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29128753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com