jQuery选择器问题(表中每个TR中的第一个TD)

时间:2010-06-01 18:55:11

标签: jquery jquery-selectors

我正在尝试将css类添加到我表中每个tr(行)的第一个td(单元格)(而不是其他td)。< / p>

有人可以帮助我使用jQuery选择器吗?

谢谢!

1 个答案:

答案 0 :(得分:10)

使用first-child选择器:

$("table tr td:first-child").text("I am the first child of the row");

一点测试:http://jsfiddle.net/WxzfQ/