[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread Karl Swedberg
Hey PD, Not a problem at all. It was a fun diversion. :-) Glad you got it working! --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On May 8, 2007, at 12:34 AM, pd wrote: Hi Karl I can't explain why but the code appears to be working as it should now.

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread pd
Hi Karl I can't explain why but the code appears to be working as it should now. Rather strange but all is well that ends well. Thanks again for your excellent, considered and patient help. pd On May 8, 1:37 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Hmmm. I'm not sure what could be causi

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread pd
Hi Karl I can't believe you did a test case for me. That's absolutely brilliant. Thank you greatly. It appears you are correct. I've modified your test case to more closely reflect my scenario: http://devel.wynlearn.net.au/nth-child.html It appears to be working as expected here. Of course my

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread Karl Swedberg
Hmmm. I'm not sure what could be causing the problem you're having with classes. I put together a simple test page using your code: $('.relevantTableClass td:nth-child(2)').css('textAlign', 'center'); inside $(document).ready and it works for me as expected: http://test.learningjquery.com/nth

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread pd
Ah, one problem Karl. Thanks again for your help though there's just one thing that I don't really understand. I was attempting to use such a selector in a site-wide $ (document).ready() context. Hence this applies to all tables which is problematic. Hence initially I was attempting the equivale

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread pd
Hi Karl That's excellent, works a treat, thanks! I tried :eq(0) and :nth(0) Selects the Nth element from the matched element set from http://docs.jquery.com/Selectors#Custom_Selectors_2 without luck. I thought it was possible though and of course the simple nth-child does the trick. I was cl

[jQuery] Re: Selectors: x td in all rows of a table

2007-05-07 Thread Karl Swedberg
If I understand your situation correctly, you might be looking for :nth-child() You could, for example, get the 2nd cell of each row this way: $('td:nth-child(2)').css('textAlign', 'center'); Remember that nth-child() is the only jQuery selector that is 1- based, because it's based solely on