Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding last <td> of each <tr> using JQuery [duplicate]

Tags:

jquery

I had two tables with same class name "Test", I need to find out last of each of first table using JQuery

Please help me out.

like image 615
Banala Ramu Avatar asked Feb 22 '13 12:02

Banala Ramu


2 Answers

jQuery 1.1.4 introduced the last-child selector:

Description: Selects all elements that are the last child of their parent.

While :last matches only a single element, :last-child can match more than one: one for each parent.

$("table:first tr td:last-child");
like image 58
jantimon Avatar answered Sep 16 '22 14:09

jantimon


$('table:first tr').each(function() {
  var lasttd=  $(this).find(':last-child')
  //your code
});
like image 32
sasi Avatar answered Sep 18 '22 14:09

sasi