• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 307
  • Last Modified:

I would like iterate through the last column in an html table and skip the first row.

I have an html table and I would like iterate through the last column in the table and skip the first row. The table is dynamic so I won't know how many columns there will be.
0
dmalovich
Asked:
dmalovich
  • 2
  • 2
1 Solution
 
Chris StanyonCommented:
Have a look at this:

$('tr').not(':first').each(function(i,row) {
    console.log( $('td:last', row).text() );
});

Open in new window

http://jsfiddle.net/ChrisStanyon/AnJ8r/
0
 
dmalovichAuthor Commented:
Yes, great thank you. Each td has an input text field. Is there an easy way to grab the value of the text field as I iterate through the column. If you would like, I can ask this as another question.
0
 
Chris StanyonCommented:
No worries. I've updated the fiddle, so have a play:

$('tr').not(':first').each(function(i,row) {
    console.log(  $('td:last input', row).val()  );
});

Open in new window

0
 
dmalovichAuthor Commented:
Perfect, thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now