以选择table中的第一列为例:
方式1:

$("table tr").find("td:first").html("first column");//错误写法:$("table tr td:first").html("first column");

方式2:

$("table tr").each(function(){ $(this).find("td:eq(0)").html("first column");  });

方式3:

$("table tr td:first-child").html("first column"); 

方式4:

$("table tr td:nth-child(1)").html("first column"); 

[扩展]

//选择最后一列

$("table tr td:last-child").html("last column"); 

//选择奇数列

$("table tr td:nth-child(odd)").html("odd colunms"); 
$("table tr td:nth-child(2n)").html("odd colunms"); 

//选择偶数列

$("table tr td:nth-child(even)").html("even colunms"); 
$("table tr td:nth-child(2n-1)").html("even colunms");

相关链接

详解CSS中:nth-child的用法

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2021-07-05
  • 2022-03-10
  • 2021-09-27
  • 2021-10-27
  • 2021-05-26
猜你喜欢
  • 2021-09-17
  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2021-07-21
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案