我有一个表,其中所有行都是这样的:
<tr>
<td class="name">name1</td>
<td class="type">type1</td>
<td class="edit">
<a href="edit" class="edit">edit</a>
</td>
</tr>
我需要禁用某些类型的编辑 href。 所以我需要类似的东西:
row = $('.mytable').find(row where .type value = type_with_no_edit) #this is where I need elp
row.find('a.edit').remove();
如果该行始终是第一行,我会这样做:
row = $('.mytable tbody>tr:first')
但情况并非总是如此。
最佳答案
听起来像是过滤器的工作......
$('.mytable tr').filter(function() {
return $("td.type", this).text() === "type_with_no_edit";
}).find('a.edit').remove();
这会找到类类型的 td 中包含文本 type_with_no_edit
的每一行,并删除同级的带有 a.edit
的 td。
关于javascript - Jquery:从单元格值获取行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13529433/