I have a 3×3 table.
I want to select each td within a specific row. (2nd row for example)
$('table > tbody > tr:nth-child(2) > td').css("background-color","red");
Above code sets only 2nd rows 1st column to red.
I expected it to modify each td in 2nd row but seems i’m missing something.
Why does above code doesn’t work as expected?
(EDIT: I’m using Chrome 13 with jquery 1.7.1)
Chrome seems to be bugged again View this demo in Chrome (observed bug in Chromium 17).
Instead of
> td, you can use.children(), which is equivalent:Demo: http://jsfiddle.net/kYZWY/2/