Basically doing that, though using eq rather than nth-child. However, I can't seem to get eq or nth-child to take a variable. When I do var idxCol = 3; jQuery("#myHeaders>th:eq(idxCol)").text(); it returns nothing, while jQuery("#myHeaders>th:eq(3)").text(); returns the header
Same with nth-child (with nth-child removing the >th). Am I missing something obvious? On Thu, Dec 4, 2008 at 11:50 AM, brian <[EMAIL PROTECTED]> wrote: > > Once you loop through the headers and get the index position of a > particular one, you could select the nth child of the row. > > On Thu, Dec 4, 2008 at 11:23 AM, Josh Rosenthal <[EMAIL PROTECTED]> > wrote: > > Hi All, > > Hopefully this is a stupid question, and I just haven't been able to find > > information about it. > > Given a table, with headers at the top. I want to loop through the rows > of > > the table (easy), and loop through the elements of each row (easy), and > > based upon the values of those elements, construct a URL. > > If I set the headers as <th scope="col">Property Name</th>, is there any > way > > to then select the cells according to their header name? > > In theory, I guess I could first loop through the non header rows, > assigning > > each cell a classname according to the header row, and then when I > process > > each row to construct my url, I can select it according to the classname. > > ... but it seems that there should be a better way. > > Any ideas? > > Josh >