How can I add a class to the first and second td in each tr?
THIS ONE 7条回答 天命终不由人 (楼主) 2020-12-05 04:40 If you want to add a class to the first and second td you can use .each() and slice() $(".location table tbody tr").each(function(){ $(this).find("td").slice(0, 2).addClass("black"); }); Example on jsfiddle 0 讨论(0) 查看其它7个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
If you want to add a class to the first and second td you can use .each() and slice()
.each()
slice()
$(".location table tbody tr").each(function(){ $(this).find("td").slice(0, 2).addClass("black"); });
Example on jsfiddle