【发布时间】:2020-01-15 22:01:31
【问题描述】:
我已经用
删除了表格行jQuery('td:contains(No)').parent().hide();
但包含以“No”开头的单词的单元格也会被删除。
这是我渲染的 html 代码:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<tr>
<th class="label">Zusatz-Info</th>
<td class="data">No</td>
</tr>
<tr>
<th class="label">Info</th>
<td class="data">Nothing</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
jQuery('td:contains(No)').parent().hide();
</script>
如何只选择包含 No 的 td?
感谢 jQuery 新手的帮助。
【问题讨论】:
标签: javascript jquery html