开发者

jQuery Selector Problem (First TD in each TR in a table)

I'm trying to add a css class to the first td (cell)开发者_开发百科 (and no other td) of each tr (row) in my table.

Can someone help me with the jQuery selector for this please?

Thank you!


Use the first-child selector:

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

A little test: http://jsfiddle.net/WxzfQ/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜