This worked great. Thx to both of you guys!!!

On Jun 24, 11:25 am, Charlie <charlie...@gmail.com> wrote:
> this works and is far shorter and sweeter:
> $("tr ").each(function() {
>        $("td:first",this).css("color","red");
>      });
> MikeyJ wrote:Looks like your first two offerings throw this error in Firebug: 
> "unlabeled break must be inside loop or switch" Your last example works but 
> it only works on the first TR and it affects both TD's in that TR. ?? On Jun 
> 24, 10:59 am, Matthew<mvbo...@gmail.com>wrote:yeah haha let me re-do: 
> $("table#id tr:first-child").each(function(){                            
> $(this).attr("attribute","value"); }); try that. I am thinking that the 
> tr:first-child should return the TD for every TR in the table. Im not sure 
> how this will work if you have nested tables. I'm at work so I cant spend the 
> time to test the code before hand. On Jun 24, 10:50 am, 
> MikeyJ<m.en...@gmail.com>wrote:Thx Matthew! Great explanation.I probably 
> should have worded one thing a bit differently...I'd like to set this 
> attribute for "the first TD in each TR for EVERY TR in an entire table". I'm 
> sure this changes things a tiny bit?MikeOn 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

Reply via email to