Solved

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

Posted on 2013-11-26
4
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

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.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

690 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