$("table.Grid tr td:nth-child(even)").css("background","gainsboro");
this did the trick - figured it out myself (ok, i read it in the zebra
striping tutorial at jquery.com and figured it would work for columns
too)
thanks all
kevin you need to try $("table.Grid tr td:even").css("background","silver");
From: kevind
To: jQuery (English)
Sent: Wednesday, January 28, 2009 9:59:20 AM
Subject: [jQuery] paint columns in alternating colour
i have this table structure - a database feeds ro
no wonder it didn't work, .Row is only on captions, try this
$(document).ready(function(){
$("table.Grid tr:even td").each().addClass("colouredtd");
});
I did mean to leave spaces yes, you write the selector just like you
would with CSS.
kevind wrote:
i added it thus:
forgot to say, it didn't work :(
i added it thus:
$(document).ready(function(){
$(".Grid .Row:even td").each().addClass("colouredtd");
});
style on page=
.colouredtd {background:silver;}
Did you mean to leave a space between .Grid and .Row
if you have to have the background color on the td use this
$(document).ready(function(){
$(".Grid .Row:even td").each().css("background","silver");
});
if you can put the background color on the tr instead and leave the td
transparent it's just this
$(document).ready(function(){
$(".Grid .Ro
6 matches
Mail list logo