Solved

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

Posted on 2013-11-26
4
293 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 42

Expert Comment

by:Chris Stanyon
Comment Utility
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
Comment Utility
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 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
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
Comment Utility
Perfect, thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now