You can combine the selectors with a ",":
$("table td:nth-child(4), table td:nth-child(5), table
td:nth-child(8)").css('text-align', 'right');
Karl
On 3/8/07, rolfsf <[EMAIL PROTECTED]> wrote:
>
> okay, so I went about it a different way, because my class wasn't working for
> some reason:
>
> $("table td:nth-child(4)").css('text-align', 'right');
>
> but now, if I want to do the same thing to, say, the 4th, 5th and 8th
> column... is there an easier way then repeating the above 3 times?
>
>
>
>
>
> rolfsf wrote:
> >
> > If I wanted to find all <td> in the 4th column of a table and add the
> > class .txt_right to them, would I do something like this:
> >
> > $('table td:nth-child(3)').addClass('txt_right');
> >
> > it doesn't seem to be working, so I must have something wrong
> >
> > thanks!
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/addClass-to-4th-column-tf3365987.html#a9366069
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/