Solved

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

Posted on 2013-11-26
4
295 Views
Last Modified: 2013-11-26
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
Comment
Question by:dmalovich
  • 2
  • 2
4 Comments
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39678379
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
 

Author Comment

by:dmalovich
ID: 39678438
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
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39678465
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
 

Author Closing Comment

by:dmalovich
ID: 39678547
Perfect, thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question