Didn't see your latest post before I posted! I'll give it a spin. Thx!
On Jun 24, 10:48 am, Matthew <mvbo...@gmail.com> wrote: > actually now that I thought about it my first post may not work... > because you'd have to first get all the tr's then take each tr and > find the first two td's. You can try my first response, if not try > this: > > $("table tr").each(function(){ > var counter = 0; > $(this).children().each(function(){ > $(this).attr("attribute","value"); > counter++; > if(counter > 1) { break; } > }); > > }); > > this will iterate through the tr's one at a time while only accessing > the first two td's for each tr. > > On Jun 24, 10:43 am, Matthew <mvbo...@gmail.com> wrote: > > > when you use this code $("tr td") it would create an array of all > > those td's in the tr. So then we just need to cycle through the first > > two and set the attribute then break the cycle. > > > var counter = 0; > > $("tr td").each(function(){ > > $(this).attr("attribute","value"); > > counter++; > > if(counter > 1) { break; } // after the first two td's stop > > the iteration through all the td's. > > > }); > > > You can be more specific with what tr you use or you could use a table > > with a certain class or id: > > > $("table.class tr td").each(........ > > > hope this helps. > > > On Jun 24, 10:26 am, MikeyJ <m.en...@gmail.com> wrote: > > > > Hi All, > > > > I'd like to set the align attribute of only the first TD in a TR for > > > an entire table but am not sure how to address them all in one go. > > > Probably an Nth child thing or similar but not sure! > > > > Thx, > > > Mike > >