jQuery and Table, grab every cell in the NTH column

前端 未结 3 411
猫巷女王i
猫巷女王i 2020-12-30 05:23

Lets say I have your basic table layout (like below). How to I grab every NTH cell? I basically want to add a css class to the cells in column N.

So if I wanted all

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 05:45

    Try the jQuery nth Cell selector... Must be there!

    $("table tr td:nth-child(n)").addClass("MyGreatClass");
    

提交回复
热议问题