<tr>
 <td>#</td>
 <td>2009</td>
 <td><a class="delete_this">Click</a></td>
</tr>


我想使用jquery并在单击锚点时获取第二(第二)“ td”的文本。我想要与锚点在同一tr中的“ td” ...

我该怎么做呢?

到目前为止,我有

$(document).ready(function(){
   $(".delete_this').click(function(){
   var myNUmber = $(this).parent()....///And this i should write the code to get the text for second td in tr where the anchor belongs to
 })
})

最佳答案

这里有几种方法:

$(this).parent().siblings("td:eq(1)").text()


如果您在寻找电池之前可以采用这种方式:

$(this).parent().prev().text()

09-11 19:53
查看更多