我有一个表结构:
<table id = "cust-id">
<tr>
<td> 1</td>
<td id = "specific_id_re"><a href = "#">link tag</a></td>
</tr>
<tr>
<td> 2 </td>
<td id = "specific_id"> <a href = "#">link tag</a></td>
</tr>
</table>
我正在尝试使用 jquery 访问每个具有 id 和链接标记的表行列,但我做不到。我一直在做的最好的事情是:
$('#cust-id').children().children().children() ; // to get access to the td elements ?
关于我应该阅读什么或我应该如何处理这个问题有什么建议吗?
谢谢 帕里贾特卡利亚
最佳答案
$('#cust-id td[id] a').each(function () {
var td = $(this).closest('td');
// do what you want
});
关于javascript - 在 jQuery 中遍历表格元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12112660/