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 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-child.html
>
> Let me know if that helps you pinpoint any differences in your code
> that might be causing the problem. Otherwise, if you could provide a
> link to your page, that might help us troubleshoot.
>
> --Karl
> _________________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On May 7, 2007, at 10:15 PM, pd wrote:
>
>
>
> > 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 equivalent (using your example)
> > of:
>
> > $('.relevantTableClass td:nth-child(2)').css('textAlign', 'center');
>
> > and I've tried this again just now but it fails.
>
> > Should a similar syntax be possible?
>
> > The following works:
>
> > $('#relevantTableId td:nth-child(2)').css('textAlign', 'center');
>
> > however a class-based solution would work better for me. Is this
> > possible?
>
> > Thanks
> > pd
>
> > On May 8, 11:20 am, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> >> 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 the CSS spec.
>
> >> Cheers,
>
> >> --Karl
> >> _________________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> >> On May 7, 2007, at 9:10 PM, pd wrote:
>
> >>> Hello
>
> >>> I've looked up
>
> >>>http://docs.jquery.com/Selectors
>
> >>> and alas I can't determine if there is a way to select the x td
> >>> of all
> >>> rows of a table.
>
> >>> The use case is that i have a table for a forum and I'd like to
> >>> center
> >>> text-align the 'Topics' and 'Replies' totals columns.
>
> >>> Thanks
> >>> pd

Reply via email to