cool - thanks!

r.



Karl Rudd wrote:
> 
> Actually, I had a bit more of a think about it and you can do this:
> 
> $("table td")
>   .filter(":nth-child(4),:nth-child(5),:nth-child(8)")
>     .css('background-color', 'red');
> 
> Slightly more compact, especially if you have a few more columns.
> 
> Karl Rudd
> 
> On 3/8/07, rolfsf <[EMAIL PROTECTED]> wrote:
>>
>> thanks! that gives me a little opening
>>
>> r.
>>
>>
>>
>> Karl Rudd wrote:
>> >
>> > 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/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/addClass-to-4th-column-tf3365987.html#a9366883
>> 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/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/addClass-to-4th-column-tf3365987.html#a9367472
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to