如何从jQuery tr标记中的最后一个td获取值? [英] How can I get the value from the last td in the tr tag in jQuery?

查看:360
本文介绍了如何从jQuery tr标记中的最后一个td获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击表格行时,我有了一张表格,我可以用它来获取行,但是如何从tr标记的最后一个td中获取值呢?

I have a table when I click on a table row I can fetch the row with this but how can I get the value from the last td in the tr tag?

$(this); // equals my hovered tr row 

我想到了这样的东西:

$(this:last-child).text(); 

还是应该这样:

$(this + ":last-child").text(); or with .html(); 

推荐答案

您可以尝试:

$(this).find(':last-child').text();

或:

$(':last-child', this).text();

这篇关于如何从jQuery tr标记中的最后一个td获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆