如何从jQuery中的tr标记中获取最后一个td的值?
当我点击一个表行时我有一个表我可以用这个获取行但是如何从tr标签中的最后一个td获取值?
$(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();
$('#' + this.id + ' :last-child').text();
是相同的:
$('#idOfMyTr :last-child').text();
console.log($( "table#hello td:nth-last-child(1)" ).text())
1 2 3, 1 2 3, 1 2 3,